- Posts: 12
- Thank you received: 0
Only import products from certain continent
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
10 years 1 month ago - 10 years 1 month ago #2639
by brotherlouis
Only import products from certain continent was created by brotherlouis
I am trying to import just a part of a specific feed. The feed contains airline tickets from allover the world. I only need tickets from Asia. The continent is one of the values available in the feed. But with the documentation I found on this subject, I still don't know how to start (since I am not a very technical guy).
I am only using the Affiliatefeeds component, not a menu item nor a module. I only need the specific data in the database (since I use a tailormade content plugin to get values from the database in content items and modules).
Anyone an idea where to start for the callback function? The information of the continent is stored in 'Select5' and is for example called 'Azië'. That is the only continent I need the data from.
I am only using the Affiliatefeeds component, not a menu item nor a module. I only need the specific data in the database (since I use a tailormade content plugin to get values from the database in content items and modules).
Anyone an idea where to start for the callback function? The information of the continent is stored in 'Select5' and is for example called 'Azië'. That is the only continent I need the data from.
Last edit: 10 years 1 month ago by brotherlouis.
Please Log in or Create an account to join the conversation.
10 years 1 month ago #2643
by bram
Replied by bram on topic Re: Only import products from certain continent
Code:
function yourcallback_cb(&$item) {
generic_cb($item);
$m5=strtolower($item['menu_5']);
if ( $m5 != 'azië') { # the ë might cause trouble then you could try: ! preg_match('#^azi.$#',$m5)
$item['title']='';
return;
}
}
Please Log in or Create an account to join the conversation.
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
10 years 1 week ago #2711
by brotherlouis
Replied by brotherlouis on topic Re: Only import products from certain continent
I tried to paste to the code in the appropriate file. I am able to select 'yourcallack_cb' under Filter/Callback. But I still see all products under 'browse items'. Am I doing something wrong?
Please Log in or Create an account to join the conversation.
10 years 1 week ago #2714
by bram
Replied by bram on topic Re: Only import products from certain continent
- did you re-import?
- did you try the version with the preg_match?
Please Log in or Create an account to join the conversation.
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
10 years 1 week ago #2722
by brotherlouis
For some strange reasing I do see the callback button in the dropdownlist but clicking on 'browse items' I don't see the name of the productfeed itself appearing allthough the feed status is set to 'active'. I did put the above stated code directly under this part:
Replied by brotherlouis on topic Re: Only import products from certain continent
- Reimport as in 'update' the feed? Yes I did
- I tried without the pregmatch and tried it with 'Afrika' in select_5 using this code:
Code:
function afrika_cb(&$item) {
generic_cb($item);
$m5strtolower($item['menu_5']);
if ( $m5 != 'Afrika') {
$item['title']='';
return;
}
}
Code:
function zodee_cb (&$item) {
generic_cb($item);
#gender is somewhere
if ( preg_match ('#(Women|Men|Teen|Boy|Girl|Baby)#',$item['_category'],$m ) ) {
$item['menu_1']=$m[1];
} else {
$item['menu_1']='Women'; # that's the situation today
}
@list($t1,$item['menu_2'],$item['menu_3'],$item['menu_4'])=explode(">",$item['menu_2']);
fashion($item);
}
Please Log in or Create an account to join the conversation.
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
10 years 1 week ago #2723
by brotherlouis
Replied by brotherlouis on topic Re: Only import products from certain continent
There is an err in the code I did paste. It was missing an =. An added it so it looks like this.
Still same behaviour though
Code:
function afrika_cb(&$item) {
generic_cb($item);
$m5=strtolower($item['menu_5']);
if ( $m5 != 'Afrika') {
$item['title']='';
return;
}
}
Still same behaviour though
Please Log in or Create an account to join the conversation.
Time to create page: 0.215 seconds