Forums / Templates, Stylesheets, Page Layout / Comming soon label when price is not setted or price is 0

Comming soon label when price is not setted or price is 0

Views: 1,512

Results 1 to 11 of 11
9 May 2012, 1:11 PM
#1
petrostro avatar

petrostro

New Zenner

Join Date:
Oct 2007
Posts:
7
Plugin Contributions:
0

Comming soon label when price is not setted or price is 0

Sorry for my english...

I want to show in the products lists a label/button "comming soon" when the price is not definied or is Zero.

sometimes I need to put a new Item in the website before have it in stock. When I do that normally dont feel the price case or simply put zero on the price.
When I do that, in the product silting show the "sold out" label.

I want to see the "sold out" label when the product have finished only (have price but is out of stock)
And I want to see the "coming soon" label when the product have no price.

Any idea how to do that ?

Many thanks

9 May 2012, 4:11 PM
#2
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Comming soon label when price is not setted or price is 0

I did something similar for someone on the product info page, maybe you can use it as a direction for the product listing page.

<?php
$products_price = zen_products_lookup((int)$_GET['products_id'], 'products_price');

    if ($products_price == 0) {
 echo 'Price Coming Soon!';
  } else {
 echo '';
}
?>
9 May 2012, 4:44 PM
#3
petrostro avatar

petrostro

New Zenner

Join Date:
Oct 2007
Posts:
7
Plugin Contributions:
0

Re: Comming soon label when price is not setted or price is 0

Thank you for quick answer.
Really I want to see that on the new product list. Here you can see my website new product list:

http://www.pcmediainformatica.com/cart/index.php?main_page=products_new

There are articles without price because are new and will be available in few days so I need to show that "coming soon" text.

Any idea where must I insert your code ?

11 May 2012, 9:23 AM
#4
petrostro avatar

petrostro

New Zenner

Join Date:
Oct 2007
Posts:
7
Plugin Contributions:
0

Re: Comming soon label when price is not setted or price is 0

I have tried editing product_listing.php, templates but still nothing.
When I change something to test, I see on main product list the changes, not in the new product list.

11 May 2012, 12:22 PM
#5
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Comming soon label when price is not setted or price is 0

This is what I did for the /includes/modules/YOUR_TEMPLATE/product_listing.php file

find this:

        case 'PRODUCT_LIST_PRICE':
        $lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
        $lc_align = 'right';
        $lc_text =  $lc_price;

        // more info in place of buy now

change to this:

        case 'PRODUCT_LIST_PRICE':
        $lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
        $lc_align = 'right';
        $lc_text =  $lc_price;

if ($listing->fields['products_price'] == 0) {
        $lc_text .= 'Price Coming Soon!';
  } else {
        $lc_text .= '';
}

        // more info in place of buy now

You can see it here

11 May 2012, 4:15 PM
#6
petrostro avatar

petrostro

New Zenner

Join Date:
Oct 2007
Posts:
7
Plugin Contributions:
0

Re: Comming soon label when price is not setted or price is 0

Thank you rbarbour

I think that is the correct way.

In this example, if you press new products, the code doesnt work. It works on the general price listing but not in the new products listing...
I´ll try to find the solution and I´ll publish here

Many thanks

11 May 2012, 4:59 PM
#7
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Comming soon label when price is not setted or price is 0

11 May 2012, 5:08 PM
#8
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Comming soon label when price is not setted or price is 0

for the tpl_modules_products_new_listing.php

try

find:

      if ((PRODUCT_NEW_LIST_PRICE != '0' and zen_get_products_allow_add_to_cart($products_new->fields['products_id']) == 'Y') and zen_check_show_prices() == true) {
        $products_price = zen_get_products_display_price($products_new->fields['products_id']);
        $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_new->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_new->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
      } else {
        $display_products_price = '';
      }

add below like:

      if ((PRODUCT_NEW_LIST_PRICE != '0' and zen_get_products_allow_add_to_cart($products_new->fields['products_id']) == 'Y') and zen_check_show_prices() == true) {
        $products_price = zen_get_products_display_price($products_new->fields['products_id']);
        $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_new->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_new->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
      } else {
        $display_products_price = '';
      }

if ($products_new->fields['products_price'] == 0) {
        $display_products_price .= 'Price Coming Soon!';
  } else {
        $display_products_price .= '';
}
11 May 2012, 6:12 PM
#9
petrostro avatar

petrostro

New Zenner

Join Date:
Oct 2007
Posts:
7
Plugin Contributions:
0

Re: Comming soon label when price is not setted or price is 0

Thank you again rbaorbour

That´s the solution , but I did little changes... What i want exactly is to hide the "SOLD OUT" label and replace it with a "COMONG SOON" when there are no price setted up or the price is zero so...
I did this changes
Edited the file: /includes/templates/template_default/templates/tpl_modules_products_new_listing.php

originally:

$the_button = $link;
        $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
        $display_products_button = zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
      } else {

inserted this code:

        $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
        if ($products_price == ''){
				$display_products_button = ' Proximamente';
				} else {
				$display_products_button =  zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
				}
      } else {

Now the new products without price present a test that say "proximamente" (coming soon in english)

The last step is to load a button that say "coming soon" instead of the "proximamente" text
:smile:

12 May 2012, 12:42 PM
#10
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Comming soon label when price is not setted or price is 0

in /includes/languages/english/YOUR_TEMPLATE/button_names.php

add:

define('BUTTON_COMING_SOON', 'button_coming_soon.gif'); 
define('BUTTON_COMING_SOON_ALT', 'Coming Soon');

if the file doesn't exist - create it

then in:
/includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_new_listing.php

where you put:

$display_products_button = ' Proximamente';

change to:

$display_products_button = zen_image_button(BUTTON_COMING_SOON, BUTTON_COMING_SOON_ALT, 'class="comingSoonButton"');

Also you should be making your changes to files within the cherry_zen folders and NOT the template_default folders for all your changes will be lost upon upgrading.

If a file doesn't exist in the cherry_zen folder just copy it from the template_default folder

hope this helps!

14 May 2012, 9:29 AM
#11
petrostro avatar

petrostro

New Zenner

Join Date:
Oct 2007
Posts:
7
Plugin Contributions:
0

Re: Comming soon label when price is not setted or price is 0

All done and working

Thank you rbarbour

Hope this is usefull for more users