Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Views: 1,542

Results 1 to 6 of 6
9 Apr 2015, 4:26 PM
#1
bronco78th avatar

bronco78th

New Zenner

Join Date:
Jan 2014
Posts:
51
Plugin Contributions:
0

Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Hi All,

We have both a Zencart and eBay shop. Basically we only take Paypal on eBay and get customers occasionally that want to pay by card or want a large order.

We send them instructions and take their payment via our Zencart store on what we call a 'One off Payment'....which is basically a product where the customer enters there value/Quote, adds it to cart and pays for it as a product.

However some are still slightly confused about what to put into the 'Quantity :" Box....I know its not rocket science but for some it appears to be! :frusty:

Page here ... http://www.thegreatgiftshop.co.uk/in...roducts_id=798

What I want to do is Change the word 'Quantity :' to a '£' sign.....

Obviously by changing the PRODUCTS_ORDER_QTY_TEXT in the Language file its a global change and I only want to change this one Product page.

How can I do it?

Ive added

define('MISCPAYMENT_ORDER_QTY_TEXT','£');

to my language file in anticipation... But to edit the product code to implement is sadly beyond my capability :dontgetit

Heres my Code from tpl_product_info_display.php

 <!--bof Add to Cart Box -->

     <?php


     if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {


       // do nothing


     } else {


     ?>


            <?php
 
         $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');


                 if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {


                   // hide the quantity box and default to 1


                   $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


                 } else {


                   // show the quantity box


         $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="12" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


                 }


         $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);


       ?>


       <?php if ($display_qty != '' or $display_button != '') { ?>


         <div id="cartAdd">


         <?php


           echo $display_qty;
           echo $display_button;


                 ?>


               </div>


       <?php } // display qty and button ?>


     <?php } // CUSTOMERS_APPROVAL == 3 ?>


     <!--eof Add to Cart Box-->

Any help would be much appreciated

Kind Regards,

John

10 Apr 2015, 1:13 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Bronco78th:

Hi All,

We have both a Zencart and eBay shop. Basically we only take Paypal on eBay and get customers occasionally that want to pay by card or want a large order.

We send them instructions and take their payment via our Zencart store on what we call a 'One off Payment'....which is basically a product where the customer enters there value/Quote, adds it to cart and pays for it as a product.

However some are still slightly confused about what to put into the 'Quantity :" Box....I know its not rocket science but for some it appears to be! :frusty:

Page here ... http://www.thegreatgiftshop.co.uk/in...roducts_id=798

What I want to do is Change the word 'Quantity :' to a '£' sign.....

Obviously by changing the PRODUCTS_ORDER_QTY_TEXT in the Language file its a global change and I only want to change this one Product page.

How can I do it?

Ive added

define('MISCPAYMENT_ORDER_QTY_TEXT','£');

> to my language file in anticipation... But to edit the product code to implement is sadly beyond my capability :dontgetit
> 
> 
> Heres my Code from tpl_product_info_display.php
> 
> ```
 <!--bof Add to Cart Box -->

     <?php


     if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {


       // do nothing


     } else {


     ?>


            <?php
 
         $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');


                 if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {


                   // hide the quantity box and default to 1


                   $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


                 } else {


                   // show the quantity box


         $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="12" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


                 }


         $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);


       ?>


       <?php if ($display_qty != '' or $display_button != '') { ?>


         <div id="cartAdd">


         <?php


           echo $display_qty;
           echo $display_button;


                 ?>


               </div>


       <?php } // display qty and button ?>


     <?php } // CUSTOMERS_APPROVAL == 3 ?>


     <!--eof Add to Cart Box-->

Any help would be much appreciated

Kind Regards,

John

Change:

$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');

To:

display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . [B]($_GET['products_id']== 22 ? MISCPAYMENT_ORDER_QTY_TEXT :  PRODUCTS_ORDER_QTY_TEXT_IN_CART)[/B] . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');

Where 22 is the product_id number of your product.

And replace the PRODUCTS_ORDER_QTY_TEXT_IN_CART with the same above bolded code elsewhere in that page, substituting the product_id number (22) for your product.

13 Apr 2015, 10:42 AM
#3
bronco78th avatar

bronco78th

New Zenner

Join Date:
Jan 2014
Posts:
51
Plugin Contributions:
0

Re: Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Thanks for the help.

Unfortunately that did not work. It still says 'Quantity' on the One off Payment page. Though im not getting any errors so we must be close.

Also PRODUCTS_ORDER_QTY_TEXT_IN_CART is only found in the Add to cart section and no where else in this tpl_product_info_display.php script.

Heres how that part looks at the moment.

   <!--bof Add to Cart Box -->

     <?php


     if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {


       // do nothing


     } else {


     ?>


            <?php
 
         $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . ($_GET['products_id'] == 798 ? MISCPAYMENT_ORDER_QTY_TEXT : PRODUCTS_ORDER_QTY_TEXT_IN_CART) . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');


                 if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {


                   // hide the quantity box and default to 1


                   $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


                 } else {


                   // show the quantity box


         $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="12" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


                 }


         $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);


       ?>


       <?php if ($display_qty != '' or $display_button != '') { ?>


         <div id="cartAdd">


         <?php


           echo $display_qty;
           echo $display_button;


                 ?>


               </div>


       <?php } // display qty and button ?>


     <?php } // CUSTOMERS_APPROVAL == 3 ?>


     <!--eof Add to Cart Box-->

Kind Regards,

John

13 Apr 2015, 7:21 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Bronco78th:

Thanks for the help.

Unfortunately that did not work. It still says 'Quantity' on the One off Payment page. Though im not getting any errors so we must be close.

Also PRODUCTS_ORDER_QTY_TEXT_IN_CART is only found in the Add to cart section and no where else in this tpl_product_info_display.php script.

Heres how that part looks at the moment.

<!--bof Add to Cart Box -->
 <?php


 if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {


   // do nothing


 } else {


 ?>


        <?php

     $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . ($_GET['products_id'] == 798 ? MISCPAYMENT_ORDER_QTY_TEXT : PRODUCTS_ORDER_QTY_TEXT_IN_CART) . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');


             if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {


               // hide the quantity box and default to 1


               $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


             } else {


               // show the quantity box


     $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="12" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);


             }


     $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);


   ?>


   <?php if ($display_qty != '' or $display_button != '') { ?>


     <div id="cartAdd">


     <?php


       echo $display_qty;
       echo $display_button;


             ?>


           </div>


   <?php } // display qty and button ?>


 <?php } // CUSTOMERS_APPROVAL == 3 ?>


 <!--eof Add to Cart Box-->
> 
> Kind Regards,
> 
> John

Yeah, sorry, wasn't fully engaged with helping... You will see in the current setup, if you add the product to your cart and then return to the product, that the quantity in cart should show the correct symbol. If not then need to enclose the 798 with single quotes. 

The other place for this tobe applied is where there is:PRODUCTS_ORDER_QTY_TEXT which was the second locationi which I meant to indicate.
14 Apr 2015, 9:39 AM
#5
bronco78th avatar

bronco78th

New Zenner

Join Date:
Jan 2014
Posts:
51
Plugin Contributions:
0

Re: Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Cheers MC,

Got it working!

One more question just for the sake of completion. I want to make 1.00 appear in the box - at the moment globally its '1'

I presume it would be something like

   $the_button = ($_GET['products_id']== '798' ? '<input type="hidden" name="cart_quantity" value="1.00" />') :  '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);)

But that naturally hasn't worked.

again thanks for the other fix :)

Regards,

John

14 Apr 2015, 11:21 AM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Want to Change Cart 'Quantity' Text on ONLY one Product. How?

Bronco78th:

Cheers MC,

Got it working!

One more question just for the sake of completion. I want to make 1.00 appear in the box - at the moment globally its '1'

I presume it would be something like

$the_button = ($_GET['products_id']== '798' ? '<input type="hidden" name="cart_quantity" value="1.00" />') : '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);)

> 
> But that naturally hasn't worked.
> 
> again thanks for the other fix :)
> 
> Regards,
> 
> John

There's a few conditions I'm sure I'm not considering:
  // show the quantity box


     $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '[B].00[/B]" maxlength="12" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);

If you want it limited by something, things change... Right now, one of the issues of the above is that if say the minimum value is say 1.75 and this is used then it will look like 1.75.00. Which isn't even a good date. There is a ZC function that can be used in place of this, but the above would be a quick and dirty.

Btw,  this is the same line of code that already has been modified in the first part of the line... But the above is based off of the original code, not your modified version.

So, why does the original code not work proposed above? Notice that the html portion of the code indicates that the type is hidden... Hidden is not displayed, therefore changing 1 to 1.00 would have no visual affect.  If you were to inspect the source code when the page was displayed, you would see that value of 1.00, but it wouldn't help your cause. :)