Any logs generated? If the $_GET['currency_code'] is set, the processing looks for that in the currencies class.
Any logs generated? If the $_GET['currency_code'] is set, the processing looks for that in the currencies class.
These PHP extension classes are new to me, but as I wanted to create a custom product_type (I used 666 as a test) for category 66 I used this code in a new classes file (includes/classes/gpsf/gpsfKb.php):
This works in that it adds the product_type to the feed,PHP Code:<?php
/**
*/
class gpsfKb extends gpsfBase
{
public function getProductsAttributes(string $products_id, array $product, array $categories_list, $cPath = '66', array $custom_fields): array
{
$extension_custom_fields = ['product_type' => '666',];
return $extension_custom_fields;
}
}
I would appreciate some guidance on the code changes needed to replace the already generated product_type rather than add a new one.Code:<g:product_type>666</g:product_type> <g:product_type><![CDATA[Gift Vouchers]]></g:product_type>
I think that this plugin's 'site-specific additions to a product feed' is going to be a stretch for most non-coders, like me, so hopefully this example will get the ball rolling.
Simon
Actually, what I've done hasn't worked as it adds the '666' to all products. Back to the drawing board.
Simon
Right, you'd need to check the incoming $products_id value and possibly the $product/$categories_list/$cPath arrays to see if the current product 'qualifies' for the change.
For what I think you're trying to do:
That checks to see if categories-id 66 is present in the current product's category-tree, returning the 'product_type' override if so; otherwise, no override is supplied.PHP Code:public function getProductsAttributes(string $products_id, array $product, array $categories_list, array $cPath, array $custom_fields): array
{
if (!in_array(66, $cPath)) {
return [];
}
$extension_custom_fields = ['product_type' => '666',];
return $extension_custom_fields;
}
At this point, the gpsfFeedGenerator class doesn't acknowledge an override for the product_type, using either a fixed value or a selection from the product's master-category's name 'tree'. I've created a change-request (https://github.com/lat9/gpsf/issues/11) on the GPSF GitHub repository.
Cindy - Excited to try this one out! I just put it on our site but I'm seeing the following debug error on ALL the products:
Any idea what I should be looking at to resolve this?Code:Array ( [20361] => # SELFIE by Simon R. Stefan & Alex Pandrea - Trick: title cannot be empty [25185] => #Augmented (Gimmick and Online Instructions) by Luca Volpe and Renato Cotini - Trick: title cannot be empty [21745] => #How by Magic from Holland and Ferry de Riemer - Trick: title cannot be empty [35629] => $1.00 Prop Bill (1 bill/$1.00 value) - Realistic Fake Money: title cannot be empty [35623] => $10.00 Prop Bill (1 bill/$10.00 value) - Realistic Fake Money: title cannot be empty [24025] => $100 bill Silk 36 inch by Magic by Gosh - Trick: title cannot be empty [12237] => $100 Bill Switch - Booklet + Gimmick by Royal Magic: title cannot be empty ..... .....
- Jeff