Results 1 to 7 of 7
  1. #1
    Join Date
    May 2007
    Posts
    18
    Plugin Contributions
    0

    Default Price in the "Add to Cart" box

    How can I make the items price shown in the "Add to Cart" box?

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Price in the "Add to Cart" box

    Look in /includes/templates/your_template/templates/tpl_product_info_display.php for the regular price display code:
    PHP Code:
    <!--bof Product Price block -->
    <h2 id="productPrices" class="productGeneral">
    <?php
    // base price 
      
    if ($show_onetime_charges_description == 'true') {
        
    $one_time '<span >' TEXT_ONETIME_CHARGE_SYMBOL TEXT_ONETIME_CHARGE_DESCRIPTION '</span><br />';
      } else {
        
    $one_time '';
      }
      echo 
    $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE '') . zen_get_products_display_price((int)$_GET['products_id']);
    ?></h2>
    <!--eof Product Price block -->
    Put the core of that in a div instead of h2, and insert it into the add to cart block in an appropriate place.
    PHP Code:
    <div id="productPricesAdd" class="productGeneral">
    <?php
    // base price 
      
    if ($show_onetime_charges_description == 'true') {
        
    $one_time '<span >' TEXT_ONETIME_CHARGE_SYMBOL TEXT_ONETIME_CHARGE_DESCRIPTION '</span><br />';
      } else {
        
    $one_time '';
      }
      echo 
    $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE '') . zen_get_products_display_price((int)$_GET['products_id']);
    ?></div>
    There are a number of locations in the add to cart code where the price code could go, depending on how you want it to display.

  3. #3
    Join Date
    May 2007
    Posts
    18
    Plugin Contributions
    0

    Default Re: Price in the "Add to Cart" box

    I'm now getting this error.

    Parse error: syntax error, unexpected T_REQUIRE in /blah/blah/blah/templates/tpl_product_info_display.php on line 1

    This is my code:

    PHP Code:
    <?php

        $display_qty 
    = (($flag_show_product_info_in_cart_qty == 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 == 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_CARTBUTTON_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="6" 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_CARTBUTTON_IN_CART_ALT);

                }

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

      
    ?>

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

        <div id="productPrices" class="productGeneral">

        <?php

        
    // base price

          
    if ($show_onetime_charges_description == 'true') {

            
    $one_time '<span >' TEXT_ONETIME_CHARGE_SYMBOL TEXT_ONETIME_CHARGE_DESCRIPTION '</span><br />';

          } else {

            
    $one_time '';

          }

          echo 
    $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE '') . zen_get_products_display_price((int)$_GET['products_id']);

        
    ?></div>

        <div id="cartAdd">

        <?php

          
    echo $display_qty;

          echo 
    $display_button;

                
    ?>

              </div>

      <?php // display qty and button ?>

    <?php // CUSTOMERS_APPROVAL == 3 ?>

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Price in the "Add to Cart" box

    And you're getting this error on line 1 of tpl_product_info_display.php?
    What does line 1 look like now?

    Nothing jumps out at me in the code you posted, except that you are not supposed to have an id twice on a page, and should change the id="productPrices" as I showed above.

    What did you use to edit the file? Some programs are known for mangling PHP code.

  5. #5
    Join Date
    May 2007
    Posts
    18
    Plugin Contributions
    0

    Default Re: Price in the "Add to Cart" box

    You are right, I use Notepad++ and it was saving all the php code in one giant line.

    Now it is working but the price is not showing inside the "Add to Cart" box. It always shows above the products details. Is it a matter of placing the code in the correct place or do I have to add some extra code somewhere for the price to display inside the "Add to Cart" box?

    Here is a link so you can see what I mean. http://csi-drives.com/index.php?main...products_id=65

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Price in the "Add to Cart" box

    I find Notepad++ to be excellent for editing PHP, but I suppose there are things you could tell it to do that would be bad for it.

    The price code needs to be inside the add to cart div for them to stay together. Try moving the

    <div id="cartAdd">

    to just above the

    <div id="productPricesAdd" class="productGeneral">

  7. #7
    Join Date
    May 2007
    Posts
    18
    Plugin Contributions
    0

    Default Re: Price in the "Add to Cart" box

    Beautiful my friend. It worked perfectly.
    Thank you very much.

 

 

Similar Threads

  1. v151 Display "add to cart" and "Call for price together"
    By Tadj Hemingway in forum General Questions
    Replies: 2
    Last Post: 6 Mar 2015, 07:53 PM
  2. v151 Price in "Add to cart" box?
    By snowgoose in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Dec 2013, 05:20 PM
  3. EasyPopulate problem: "Add to Cart" and "price" not showing on product info page
    By pcspot in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 29 Apr 2010, 08:06 AM
  4. Replies: 0
    Last Post: 17 Mar 2010, 05:24 PM
  5. how to shows "call for price" and "add to cart"?
    By iofferfashion in forum Managing Customers and Orders
    Replies: 3
    Last Post: 15 Dec 2009, 04:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg