Forums / All Other Contributions/Addons / add "products_quantity_order_min" to strcutre data markup

add "products_quantity_order_min" to strcutre data markup

Views: 847

Results 1 to 2 of 2
6 Oct 2020, 8:06 PM
#1
chadlly2003 avatar

chadlly2003

Totally Zenned

Join Date:
Jan 2015
Posts:
820
Plugin Contributions:
0

add "products_quantity_order_min" to strcutre data markup

Zencart 5.7
php 7.4

I am currently using zencart super data markup
https://www.zen-cart.com/downloads.php?do=file&id=1984

I need to add the field "products_quantity_order_min" into the structure data.

In the super_data_head.php the code is below.

I tried adddng this <?php Print $products_quantity_order_min; ?> but nothing ever populates.

Can someone assist me or lead me in the right direction on getting the min-order-quantity on the structure data

<script type="application/ld+json">


{

  "@context": "http://schema.org",

   "@type": "Product",

   "@id": "<?php echo htmlspecialchars_decode($canonicalLink, ENT_NOQUOTES); ?>",

    "brand": "<?php echo $manufacturers_name; ?>",

    "mpn": "<?php echo htmlspecialchars($products_model); ?>",

    "sku": "<?php echo $products_id; ?>",

    "url": "<?php echo htmlspecialchars_decode($canonicalLink, ENT_NOQUOTES); ?>",

    "name": "<?php echo htmlspecialchars($products_name); ?>",

    "description": "<?php echo META_TAG_DESCRIPTION; ?>",

    "image": "<?php echo $fb_image; ?>",


   "offers": {

    "@type" : "Offer",

    "availability" : "<?php if ($products_quantity > 0) { ?>http://schema.org/InStock<?php } ?><?php if ($products_quantity == 0) { ?>http://schema.org/OutOfStock<?php }?>",

    "price" : "<?php echo $specials_new_products_price = (round(zen_get_products_actual_price($product_info_metatags->fields['products_id']),2)); ?>",

    "priceCurrency" : "<?php if (FACEBOOK_OPEN_GRAPH_CUR != '') { ?><?php echo FACEBOOK_OPEN_GRAPH_CUR; ?><?php } ?>",

    "seller" : "<?php echo STORE_NAME; ?>",

    "itemCondition" : "http://schema.org/<?php if (FACEBOOK_OPEN_GRAPH_COND != '') { ?><?php echo FACEBOOK_OPEN_GRAPH_COND; ?><?php }?>",

    "inventoryLevel" : "<?php echo $products_quantity; ?>",    

    "deliveryLeadTime" : "<?php if (FACEBOOK_OPEN_GRAPH_DTS != '') { ?><?php echo FACEBOOK_OPEN_GRAPH_DTS; ?><?php }?>",

    "category" : "<?php echo htmlspecialchars($categories->fields['categories_name']); ?>",

    "itemOffered" : "<?php echo htmlspecialchars($products_name); ?>",

    "url": "<?php echo htmlspecialchars_decode($canonicalLink, ENT_NOQUOTES); ?>",

    "priceValidUntil": "<?php echo date('Y-m-d', strtotime("+30 days")); ?>",
     
    "eligibleRegion" : "<?php if (FACEBOOK_OPEN_GRAPH_ELER != '') { ?><?php echo FACEBOOK_OPEN_GRAPH_ELER; ?><?php }?>",

    "acceptedPaymentMethod" : [ "http://purl.org/goodrelations/v1#<?php echo FACEBOOK_OPEN_GRAPH_PAY1; ?>,http://purl.org/goodrelations/v1#<?php echo FACEBOOK_OPEN_GRAPH_PAY2; ?>,http://purl.org/goodrelations/v1#<?php echo FACEBOOK_OPEN_GRAPH_PAY3; ?>,http://purl.org/goodrelations/v1#<?php echo FACEBOOK_OPEN_GRAPH_PAY4; ?>,http://purl.org/goodrelations/v1#<?php echo FACEBOOK_OPEN_GRAPH_PAY5; ?>,http://purl.org/goodrelations/v1#<?php echo FACEBOOK_OPEN_GRAPH_PAY6; ?>" ]    


} 

}

</script>
6 Oct 2020, 10:57 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: add "products_quantity_order_min" to strcutre data markup

As far as I can tell there's no such field for minimum product quantity in the official structured-data Product schema, so I'm not sure what your real goal is, nor "where" you believe it belongs in the generated structured-data output.

But ... to retrieve the value from Zen Cart:
Around line 114 is a list of fields being retrieved from the database. Add yours on a new line there. Be sure to include the comma which separates it from other fields.
Then you can refer to it like: $product_info->fields['your_field_name_here']

and then echo it into whatever part of the structured data json output you believe it belongs in.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.