- Posts: 12
- Thank you received: 0
Menu Call Back
8 years 11 months ago - 8 years 11 months ago #3714
by awd1975
Menu Call Back was created by awd1975
Hi I am using the blow code
for various imports on most of the category it selects the last category as the menu2 item which is correct, but when the category is Men > Sale > Shoes > Trainers > High-top Trainers
it selects Men as this menu 2 item.
Why is this not working
Code:
list($item['menu_2'],$item['menu_3'],$item['menu_4'])=
explode(" > ",$item['menu_2'],3);
for various imports on most of the category it selects the last category as the menu2 item which is correct, but when the category is Men > Sale > Shoes > Trainers > High-top Trainers
it selects Men as this menu 2 item.
Why is this not working
Last edit: 8 years 11 months ago by redactie.
Please Log in to join the conversation.
8 years 11 months ago - 8 years 11 months ago #3716
by redactie
Replied by redactie on topic Menu Call Back
the explode puts the first element in the menu_2 in your example that is 'men'
A > B > C > D > E
menu_2 = A
menu_3 = B
menu_4 = C
D,E = trashed
if you want the last element in menu_2 you can use something like
Some feeds hava a fixed order in the category path thus A = gender,B = category C= sub category.
others have a fairly messy category path like B = category for some items or 'sale' for some others where C becomes the category.
A > B > C > D > E
menu_2 = A
menu_3 = B
menu_4 = C
D,E = trashed
if you want the last element in menu_2 you can use something like
Code:
$a=explode('>',$item['menu_2']);
$item['menu_2']=array_pop($a); # E
Some feeds hava a fixed order in the category path thus A = gender,B = category C= sub category.
others have a fairly messy category path like B = category for some items or 'sale' for some others where C becomes the category.
Last edit: 8 years 11 months ago by redactie.
The following user(s) said Thank You: awd1975
Please Log in to join the conversation.
Time to create page: 0.379 seconds