Author Topic: Email products order sorted by category  (Read 442 times)

Offline marceloaraujo

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Email products order sorted by category
« on: February 17, 2018, 11:05:20 AM »
Hello,

I would like to know how I change the products sort on the email order. I need the products to be in sorted by of category.

Regards,
Marcelo

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Karma: +228/-10
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Email products order sorted by category
« Reply #1 on: February 19, 2018, 06:56:30 AM »
Hello.
What email are you talking about? Order notification?

You can change products array via you custom  extension hook.

Example
Code: [Select]
public function onModelCheckoutOrder_ProcessData(){
   if(func_get_arg(0) != 'sf_order_confirm_mail'){
       //prevent multiiple calls
       return null;
   }
   $that = $this->baseObject;
   $that->data['mail_template_data']['products'] = array(....);  //build your own array here
}

You can find place with hook call in public_html/storefront/model/checkout/order.php line 615

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline marceloaraujo

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Email products order sorted by category
« Reply #2 on: February 20, 2018, 07:25:59 AM »
Yes it is the notification email.

As it says in my profile, i'm a newbie!!  ;)
Can you help me with the array?

Regards,
Marcelo
« Last Edit: February 20, 2018, 07:34:54 AM by marceloaraujo »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 3938
  • Karma: +236/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Email products order sorted by category
« Reply #3 on: February 20, 2018, 07:54:23 AM »
marceloaraujo, are you AbanteCart or coding newbie?

You can change product sorting for products in order confirmation email, by changing data select order

On line #358:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/model/checkout/order.php#L358

Change below code for selection to appropriate sorting

      $order_product_query = $this->db->query("SELECT *
                                     FROM " . $this->db->table("order_products") . "
                                     WHERE order_id = '" . (int)$order_id . "'");

Something like " order by product_id "
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 3938
  • Karma: +236/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Email products order sorted by category
« Reply #4 on: February 20, 2018, 07:56:12 AM »
marceloaraujo, are you AbanteCart or coding newbie?

You can change product sorting for products in order confirmation email, by changing data select order

On line #358:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/model/checkout/order.php#L358

Change below code for selection to appropriate sorting

      $order_product_query = $this->db->query("SELECT *
                                     FROM " . $this->db->table("order_products") . "
                                     WHERE order_id = '" . (int)$order_id . "'");

Something like " order by product_id "

If you care about easy future upgrades, I suggest you create an override or hook to this model.
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

 

LoliPromDress.com Prom dresses 2018