- Posts: 45
- Thank you received: 0
Sort by product_code in mail
- Squashtoppertje
-
Topic Author
- Offline
Less
More
10 years 9 months ago #223610
by Squashtoppertje
Sort by product_code in mail was created by Squashtoppertje
-- HikaShop version -- : 2.6.0. Business
Hi,
I want to sort the products in the notification mail by product_code. How can I get this done?
Thanks!
Hi,
I want to sort the products in the notification mail by product_code. How can I get this done?
Thanks!
Please Log in or Create an account to join the conversation.
10 years 9 months ago #223622
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Sort by product_code in mail
Hi,
It will require some custom code in your email "preload".
When you edit an email in the HikaShop backend (HikaShop business required), you have three parts (html, text, preload).
The preload is the PHP code which generate the content data for the html/text parts.
In that preload code, you will find that :
You need to insert the "$cartProduct" in the "$cartProducts" array but with the product code as key. So after the addition of all products in the array, you can sort the array by the array key (which will be the product code).
Regards,
It will require some custom code in your email "preload".
When you edit an email in the HikaShop backend (HikaShop business required), you have three parts (html, text, preload).
The preload is the PHP code which generate the content data for the html/text parts.
In that preload code, you will find that :
Code:
$cartProducts[] = $cartProduct;
}
$templates['PRODUCT_LINE'] = $cartProducts;
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 9 months ago #223697
by Squashtoppertje
Replied by Squashtoppertje on topic Sort by product_code in mail
Hi Jerome,
Thanks for your answer.
I tried the following:
Around line 120 of the preload version I changed the array code to:
But this didn't have effect in the email. Probably I did something wrong.
Can you help me a bit more?
Thanks!
Thanks for your answer.
I tried the following:
Around line 120 of the preload version I changed the array code to:
Code:
//$cartProducts = array();
// ADDED FOR SORTING IN EMAIL
$cartProducts = array($item->order_product_code => $cartProduct );
ksort($item->order_product_code);
// END ADDITION
$cartFooters = array();
But this didn't have effect in the email. Probably I did something wrong.
Can you help me a bit more?
Thanks!
Please Log in or Create an account to join the conversation.
10 years 9 months ago #223722
by nicolas
Replied by nicolas on topic Sort by product_code in mail
Hi,
Your code is not correct.
The line:
should be replaced by:
and then, you should add the line:
before the line:
Your code is not correct.
The line:
Code:
$cartProducts[] = $cartProduct;
Code:
$cartProducts[$item->order_product_code] = $cartProduct;
Code:
ksort($cartProducts);
Code:
$templates['PRODUCT_LINE'] = $cartProducts;
The following user(s) said Thank You: Squashtoppertje
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
10 years 9 months ago #223857
by Squashtoppertje
Replied by Squashtoppertje on topic Sort by product_code in mail
Yes, this works. Thanks a lot!
Please Log in or Create an account to join the conversation.
Time to create page: 0.211 seconds