Add product_id to Schema and Opengraph for Pixels?

Open to all! Ask other shopowners for help.
Post Reply
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Add product_id to Schema and Opengraph for Pixels?

Post by lecarlb »

Hello,

I was wondering how to add the product id to ht_schema and ht_opengraph mainly for Facebook Pixel?

It's for a 1.0.8.4 shop.

If you need more info, let me know.

I thought it was as simple as adding 'id' => $product_info['products_id'], to ht_schema.php but obviously some supporting code is needed.


Thank you.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Add product_id to Schema and Opengraph for Pixels?

Post by burt »

These instructions are for Phoenix 1.0.8.19 and blow.
These instructions are not for 1.0.8.20 onwards, where you can do all this with a hook.

1.0.8.19 and below

For schema I believe it is productID, so;

Code: Select all

$schema_product['productID'] = (int)$product_info['products_id'];
placed just above

Code: Select all

$data = json_encode($schema_product);

--

For opengraph I believe it is product:retailer_item_id, so;

Code: Select all

$data['product:retailer_item_id'] = (int)$product->get('id');
placed just above
$result = '';
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply