Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Microdate vs price-by-attributes

Microdate vs price-by-attributes

Views: 3,583

Results 1 to 20 of 39
30 Sep 2015, 1:18 AM
#1
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Microdate vs price-by-attributes

Hi,
Google Microdata plugin catch product price but not attribute. For price by attribute it catches price as 0 because our starting price is 0 and hidden as each attribute have its own price with out + sign.

I have check file and it have following line which caching price:

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

Any idea how to change it so it catch regular price when no attribute available and catch attribute price when present?

Thank you!

30 Sep 2015, 1:25 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Could you post the code that you are using 5 lines before and 5 lines after?

30 Sep 2015, 1:28 PM
#3
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

<script type="application/ld+json">
{
  "@context": "http://schema.org",
   "@type": "Product",
    "brand": "<?php echo $manufacturers_name; ?>",
    "mpn": "<?php echo $products_model; ?>",
    "productID": "<?php echo $products_id; ?>",
    "url": "<?php echo $canonicalLink; ?>",
    "name": "<?php echo $products_name; ?>",
    "description": "<?php echo META_TAG_DESCRIPTION; ?>",
    "image": "<?php echo HTTP_SERVER . DIR_WS_CATALOG . 'images/' . $products_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 $categories->fields['categories_name']; ?>",
    "itemOffered" : "<?php echo $products_name; ?>",
    "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>
30 Sep 2015, 1:40 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

What happens if you change:

$product_info_metatags->fields['products_id']

to be:

$products_id

This is assuming that the:

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

displays the products_id correctly ...

30 Sep 2015, 11:34 PM
#5
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

No change still same. Product with price by attribute it catch price as 0 I think it is catching starting at price not attribute price as on site I have turned off starting at price and remove attribute prefix + and each attribute have total price (unique).

So I think need to add something to when starting price is 0 it should catch attribute price. I tried else statement and attribute code next to it but then page did not load.

1 Oct 2015, 3:11 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Have you an URL to the page where you are using this that we could perhaps peek at? :lookaroun

1 Oct 2015, 3:15 PM
#7
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

sent via message.

1 Oct 2015, 3:48 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Above that script code, add this:

$microdate_price = (round(zen_get_products_actual_price((int)$_GET['products_id']),2));

and then use this for the price:

    "price" : "<?php echo $microdate_price; ?>",
1 Oct 2015, 4:22 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Also, if that does not work ... check the Attribute settings on the Product in the Attributes Controller ...

Do you have the settings for:

Include in Base Price
When Priced by Attributes

marked as YES?

2 Oct 2015, 1:11 AM
#10
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

Yes I have.

I also apply change you suggested and now view source shows "price" : "", which means it no longer getting 0 as price or base price but also not getting attribute price. As there are multiple attributes on same page and multiple prices so how this will know which one to catch. I think this module may only work for 1 price for all attribute but not sure as you know lot more than me :)

2 Oct 2015, 1:44 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Make sure that the code:

$microdate_price = (round(zen_get_products_actual_price((int)$_GET['products_id']),2));

is inside <?php ... ?> brackets as I see it echoing on your screen ...

2 Oct 2015, 2:12 AM
#12
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

I did but now it shows "price" : "0",

PS: It works for first attribute only if I select yes for include attribute in base price not for remaining attributes.

But turning include attribute in base price to yes shows first attribute price as main price. How I can hide that as I only want prices to appear next to attribute.

2 Oct 2015, 2:29 AM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Priced by Attribute takes the lowest price of all of the Attribute Option Name Groups for the Product and combines the lowest price of each group to make up the Starting Price ...

What do you want to see for the:
Microdata Price?

Give 3 URLs that are Priced by Attribute and what you want to see for the Microdata Price ...

2 Oct 2015, 2:33 AM
#14
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

sent. Please check msgs.

2 Oct 2015, 2:35 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

Could you Zip your tpl_product_info_display.php that you are using for this template and attach it to your post via the Go Advanced as I have no idea what code you are using on your pages ...

2 Oct 2015, 2:41 AM
#16
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

Sent url for zip folder inbox.

2 Oct 2015, 2:48 AM
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

What version Zen Cart are you using?

2 Oct 2015, 2:49 AM
#18
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

Its 1.5.3

2 Oct 2015, 3:03 AM
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Microdate vs price-by-attributes

What happens if you change line 71 to be:

  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . (zen_has_product_attributes_values((int)$_GET['products_id']) ? '' : zen_get_products_display_price((int)$_GET['products_id']));
2 Oct 2015, 10:31 AM
#20
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Microdate vs price-by-attributes

It does hide the starting at/base price and micro taking lowest price. Thank you!

So how I can change all existing attributes to yes for include in base price. Any SQL command or I have to change manually each?

and there is no way right now to have micro catch both attribute prices on this page?