Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2013
    Location
    Dorset, UK
    Posts
    124
    Plugin Contributions
    0

    Default Adding the ++ & -- operators to cart.

    Hi,

    I am looking for a way to add the ++ & -- operators to my tpl_shopping_cart_default.php.

    I have found this in file tpl_shopping_cart_default.php:


    PHP Code:
    <td class="cartQuantity">
                <span class="mobile-only"><?php echo TABLE_HEADING_QUANTITY?>:</span>
                <?php echo $product['quantityField'] . '<span class="alert bold">' $product['flagStockCheck'] . '</span>' $product['showMinUnits'];
    //              }
                
    ?>
    Can anyone please help me turn this into working increment and decrement icons for my cart quantity.

    Thanks

  2. #2
    Join Date
    Nov 2013
    Location
    Dorset, UK
    Posts
    124
    Plugin Contributions
    0

    help question Re: Adding the ++ & -- operators to cart.

    Hi everyone.

    Ok have worked it a bit further.

    Below is the whole of my table data for cart items. Note: some of the lines have been commented out to display the cart with the quantity box displayed and an editable and updateable value. I simply am looking for help to add increment and decrement icons as well as the update and remove.

    Cart image:
    Name:  cart2.jpg
Views: 85
Size:  36.6 KB


    PHP Code:

    <table id="cartContentsDisplay">
         <tr class="tableHeading">
            <th scope="col" id="scImageHeading"></th>
            <th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
            <th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE?></th>
            <th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY?></th>
            <th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL?></th>
         </tr>
             <!-- Loop through all products /-->
            <!-- <th scope="col" id="scRemoveHeading">&nbsp;</th> -->
    <?php
      
    foreach ($productArray as $product) {
    ?>
         <tr class="<?php echo $product['rowClass']; ?>">
            <td class="productImage">
                <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span></a>
            </td>
            <td class="cartProductDisplay">
                <span class="mobile-only"><?php echo TABLE_HEADING_PRODUCTS?>:</span>
                <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' $product['flagStockCheck'] . '</span>'?></span></a>
                <?php
                  
    echo $product['attributeHiddenField'];
                  if (isset(
    $product['attributes']) && is_array($product['attributes'])) {
                  echo 
    '<div class="cartAttribsList">';
                  echo 
    '<ul>';
                    
    reset($product['attributes']);
                    foreach (
    $product['attributes'] as $option => $value) {
                
    ?>

                          <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER nl2br($value['products_options_values_name']); ?></li>

                <?php
                    
    }
                  echo 
    '</ul>';
                  echo 
    '</div>';
                  }
                
    ?>
            </td>
           
            <td class="cartUnitDisplay">
                <span class="mobile-only"><?php echo TABLE_HEADING_PRICE?>:</span>
                <?php echo $product['productsPriceEach']; ?>
            </td>
            <td class="cartQuantity">
                <span class="mobile-only"><?php echo TABLE_HEADING_QUANTITY?>:</span>
                <?php
    //              if ($product['flagShowFixedQuantity']) {
    //                echo $product['showFixedQuantityAmount'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>' . $product['showMinUnits'];
    //              } else {
                    
    echo $product['quantityField'] . '<span class="alert bold">' $product['flagStockCheck'] . '</span>' $product['showMinUnits'];
    //              }
                
    ?>
                <div class="qty-btns">
                    <?php
                      
    if ($product['buttonUpdate'] == '') {
                        echo 
    '' ;
                      } else {
                        echo 
    $product['buttonUpdate'];
                      }
                    
    ?>

                    <?php
                        
    if ($product['buttonDelete']) {
                    
    ?>
                        <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART'action=remove_product&product_id=' $product['id']); ?>">Remove</a>
                    <?php
                        
    }
                        if (
    $product['checkBoxDelete'] ) {
                            
    // echo zen_draw_checkbox_field('cart_delete[]', $product['id']);
                        
    }
                    
    ?>
                </div>
            </td>
            <td class="cartTotalDisplay">
                <span class="mobile-only label">
                    <?php echo TABLE_HEADING_TOTAL?>:
                </span>
                <?php echo $product['productsPrice']; ?>
            </td>
        </tr>
        <?php
          
    // end foreach ($productArray as $product)
        
    ?>
        <!-- Finished loop through all products /-->
    </table>
    Open to suggestions.

    Thanks in advance.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Adding the ++ & -- operators to cart.

    Don't have "the" solution, but if you want the values to immediately change without page reload then will need to use something like javascript/jQuery, otherwise could use new buttons that upon click modify the values. By effectively performing an update/refresh operation of the page. This second option would be a bit "slower" for the user as the page would need to be reloaded on every click.

    Regardless of the method, need to take into account things like minimum quantity, maximum quantity and intervals (units) like that must purchase in groups of two.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Adding Space between Cart & Bottom of Page
    By perkiekat in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 Oct 2009, 11:52 PM
  2. Adding links to the header & footer
    By Shane78 in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 25 Feb 2009, 10:24 PM
  3. Changing the behavior of the cart page & cart sidebox
    By bodyjewelrystores in forum General Questions
    Replies: 12
    Last Post: 3 Feb 2009, 07:04 PM
  4. Adding Option Names & Values to Cart
    By MedallionMan in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 9 Jun 2008, 02:45 PM

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