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):
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;
}
}
This works in that it adds the product_type to the feed,
Code:
<g:product_type>666</g:product_type>
<g:product_type><![CDATA[Gift Vouchers]]></g:product_type>
I would appreciate some guidance on the code changes needed to replace the already generated product_type rather than add a new one.
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.
Bookmarks