- Posts: 1421
- Thank you received: 234
Only import products from certain continent
10 years 2 months ago - 10 years 2 months ago #2724
by redactie
Replied by redactie on topic Re: Only import products from certain continent
function afrika_cb(&$item) {
generic_cb($item);
$m5=strtolower($item);
if ( $m5 != 'afrika') {
$item='';
return;
}
}
generic_cb($item);
$m5=strtolower($item);
if ( $m5 != 'afrika') {
$item='';
return;
}
}
Last edit: 10 years 2 months ago by redactie.
Please Log in to join the conversation.
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
10 years 2 months ago #2725
by brotherlouis
Replied by brotherlouis on topic Re: Only import products from certain continent
Great, it works! I didn't know that the behaviour would be different between 'Afrika' and 'afrika'. Thank you so much!
Please Log in to join the conversation.
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
10 years 2 months ago #2726
by brotherlouis
Replied by brotherlouis on topic Re: Only import products from certain continent
Mmm for some feeds it works great for others where 'continent' is 'aziƫ' instead of 'azie' it doesn't like you predicted.
Is this how it should work?
or this?
Is this how it should work?
Code:
generic_cb($item);
$m5 = strtolower($item['menu_5']);
if ( preg_match('#^azi.$#',$m5)) {
$item['title']='';
return;
}
}
or this?
Code:
generic_cb($item);
$m5 = strtolower($item['menu_5']);
if ! preg_match('#^azi.$#',$m5) {
$item['title']='';
return;
}
}
Please Log in to join the conversation.
- brotherlouis
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
10 years 2 months ago #2727
by brotherlouis
Replied by brotherlouis on topic Re: Only import products from certain continent
I did find a working solution!
Works fine with me suppose. Work with countries the same way as well as with other regex i.e.
in case you only want to select countries with this callback filter.
Code:
function continents_cb(&$item) {
generic_cb($item);
$m5 = strtolower($item['menu_5']);
if ( ! preg_match('#(azi.)#',$m5)) {
$item['title']='';
return;
}
}
Works fine with me suppose. Work with countries the same way as well as with other regex i.e.
Code:
if ( ! preg_match('#(indonesi.)|india|cambodja#',$m5)) {
in case you only want to select countries with this callback filter.
Please Log in to join the conversation.
Time to create page: 0.451 seconds