Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    Huddersfield, UK
    Posts
    14
    Plugin Contributions
    0

    Default Move quantity input but not add to cart button

    Hi,

    I've been playing about with the tpl_product_info_display.php file for a while now but can't seem to split the quantity input box and add to cart button.

    What I want to do is have the quantity box above my attributes but have the add to cart button below them. Any ideas?

    Thanks,

    Scott.

  2. #2
    Join Date
    Mar 2009
    Location
    Huddersfield, UK
    Posts
    14
    Plugin Contributions
    0

    Default Re: Move quantity input but not add to cart button

    I've managed to do this so for anyone else who's interested here it is:

    PHP Code:
    <!--bof Add to Cart Box -->
    <?php

      
    if (CUSTOMERS_APPROVAL == and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') { 
        
    // do nothing
      

      
      else {
      
    ?>

    <?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_quantity '<input type="hidden" class="qty" name="cart_quantity" value="1" />' zen_draw_hidden_field('products_id', (int)$_GET['products_id']);
        
    $the_button zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT);
      } 
      
      else {
        
    // show the quantity box
        
    $the_quantity PRODUCTS_ORDER_QTY_TEXT '<input type="text" class="qty" 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']); 
        
    $the_button zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT);
      }
      
      
    $display_quantity zen_get_buy_now_button($_GET['products_id'], $the_quantity);
      
    $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_quantity;
      
    ?>
    </div>

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

    <!--bof Attributes Module -->
    <?php
      
    if ($pr_attr->fields['total'] > 0) {
    ?>
    <?php
    /**
     * display the product atributes
     */
      
    require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
    <?php
      
    }
    ?>

                <?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 = '<label for="cart_quantity">' . PRODUCTS_ORDER_QTY_TEXT . '</label>' . '<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']) . '' . 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);
      */?>
    <!--eof Attributes Module -->

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

    <div id="cartsub">
      <?php
        
    echo $display_button;
      
    ?>
    </div>

    <?php // display qty and button ?>

    <?php // CUSTOMERS_APPROVAL == 3 ?>

    <!--eof Add to Cart Sub-->
    What this does is split the quantity input and add to cart box putting them either side of the product attributes section. The quantity ends up in div[id="cartAdd"] and the add to cart button in div[id="cartSub"].

    If anyone better at php than me (not difficult!) can see anything horribly wrong with this please let me know as to avoid problems later.

    Thanks,

    Scott.

  3. #3
    Join Date
    Mar 2009
    Location
    Huddersfield, UK
    Posts
    14
    Plugin Contributions
    0

    Default Re: Move quantity input but not add to cart button

    Sorry, there's an unclosed <div> in there, use this instead...

    PHP Code:
    <!--bof Add to Cart Box -->
    <?php

      
    if (CUSTOMERS_APPROVAL == and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') { 
        
    // do nothing
      

      
      else {
      
    ?>

    <?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_quantity '<input type="hidden" class="qty" name="cart_quantity" value="1" />' zen_draw_hidden_field('products_id', (int)$_GET['products_id']);
        
    $the_button zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT);
      } 
      
      else {
        
    // show the quantity box
        
    $the_quantity PRODUCTS_ORDER_QTY_TEXT '<input type="text" class="qty" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><div id="minmaxqty"><p>' zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '</p></div>' zen_draw_hidden_field('products_id', (int)$_GET['products_id']); 
        
    $the_button zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT);
      }
      
      
    $display_quantity zen_get_buy_now_button($_GET['products_id'], $the_quantity);
      
    $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_quantity;
      
    ?>
    </div></div>

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

    <!--bof Attributes Module -->
    <?php
      
    if ($pr_attr->fields['total'] > 0) {
    ?>
    <?php
    /**
     * display the product atributes
     */
      
    require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
    <?php
      
    }
    ?>

                <?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 = '<label for="cart_quantity">' . PRODUCTS_ORDER_QTY_TEXT . '</label>' . '<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']) . '' . 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);
      */?>
    <!--eof Attributes Module -->

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

    <div id="cartsub">
      <?php
        
    echo $display_button;
      
    ?>
    </div>

    <?php // display qty and button ?>

    <?php // CUSTOMERS_APPROVAL == 3 ?>

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

 

 

Similar Threads

  1. v150 Move add to cart button
    By CnTGifts in forum General Questions
    Replies: 2
    Last Post: 5 May 2012, 09:52 PM
  2. Add to cart button and quantity textbox not showing
    By atgeorge in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 19 May 2009, 05:12 AM
  3. move add to cart button
    By marypotter in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 4 Jun 2008, 05:47 AM
  4. Move add to cart button?
    By julieoolie in forum Templates, Stylesheets, Page Layout
    Replies: 16
    Last Post: 27 Mar 2008, 03:05 PM
  5. move add to cart button
    By mole69 in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 13 Aug 2006, 04:15 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