how to remove the first category from Google Product Feed
- nico.van.leeuwen
-
Topic Author
- Offline
Less
More
4 years 6 months ago - 4 years 6 months ago #341089
by nico.van.leeuwen
-- HikaShop version -- : 4.5.1
-- Joomla version -- : 4.1.2
-- PHP version -- : 8.0
Hi,
Is it doable to have the first category removed from the product_type field in the Google Product Feed?
Or have some sort of search / replace option for these fields?
I understand this needs some PHP work done by a programmer but I'm just trying to see if it's possible and maybe some tips to get started in the right direction
Thanks.
-- Joomla version -- : 4.1.2
-- PHP version -- : 8.0
Hi,
Is it doable to have the first category removed from the product_type field in the Google Product Feed?
Or have some sort of search / replace option for these fields?
I understand this needs some PHP work done by a programmer but I'm just trying to see if it's possible and maybe some tips to get started in the right direction
Thanks.
Last edit: 4 years 6 months ago by nico.van.leeuwen. Reason: solved
Please Log in or Create an account to join the conversation.
4 years 6 months ago #341093
by nicolas
Replied by nicolas on topic how to remove the first category from Google Product Feed
Hi,
Removing the first category from the product_type should be quite easy for a developer.
In the file plugins/hikashop/google_products.php you have that code:
to skip the first category, you could replace that code by:
Now please remember that this file will be overwritten each time you update HikaShop. So you'll loose your changes there and you'll have to redo them.
Removing the first category from the product_type should be quite easy for a developer.
In the file plugins/hikashop/google_products.php you have that code:
Code:
foreach($product->categories_id as $catID){
foreach($category_path as $id=>$catPath){
if($id == $catID){
if(strlen($type.str_replace(',', ' ', $catPath['path']).',') > 750) continue;
$type .= str_replace(',', ' ', $catPath['path']).',';
}
}
}
Code:
$first = true;
foreach($product->categories_id as $catID){
foreach($category_path as $id=>$catPath){
if($id == $catID){
if($first) { $first = false; continue; }
if(strlen($type.str_replace(',', ' ', $catPath['path']).',') > 750) continue;
$type .= str_replace(',', ' ', $catPath['path']).',';
}
}
}
The following user(s) said Thank You: nico.van.leeuwen
Please Log in or Create an account to join the conversation.
Time to create page: 0.054 seconds