Results 1 to 9 of 9
  1. #1
    Join Date
    May 2012
    Posts
    137
    Plugin Contributions
    0

    Default give attributes their own colum in the shopping cart?

    Site: http://www.toolsforchrist.com/shop

    I am selling shirts and will have 2 attributes (size, color). I dont like having the attributes shown in bulleted format below the item name. Is there a way to give the attributes their own colum?

    Thanks
    Corey

  2. #2
    Join Date
    May 2012
    Posts
    137
    Plugin Contributions
    0

    Default Re: How to give attributes their own colum in the shopping cart?

    After doing this all day I finally figured most of it out. In case anyone is ever trying to do the same thing here is what I did in /includes/templates/CUSTOM/templates/tpl_shopping_cart_default.php

    This below section places the headings in the shopping cart header in order. From top down, the headings shop up left to right on the shopping cart. The code in red is what I added.

    <table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
    <tr class="tableHeading">
    <th scope="col" id="scUpdateQuantity">&nbsp;</th>
    <th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
    <th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
    <th scope="col" id="Size"><?php echo "Size"; ?></th>
    <th scope="col" id="Color"><?php echo "Color"; ?></th>

    <th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE; ?></th>
    <th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
    <th scope="col" id="scRemoveHeading">&nbsp;</th>

    Then this below section incldes the shoppers selected option within the attribute. The code in red is what I changed. Note that I also deleted some code.


    <?php
    echo $product['attributeHiddenField'];
    if (isset($product['attributes']) && is_array($product['attributes'])) {
    echo '<div class="cartAttribsList">';

    reset($product['attributes']);
    foreach ($product['attributes'] as $option => $value) {
    ?>
    <th class="cartAttribsList"><?php echo nl2br($value['products_options_values_name']); ?></th>
    <?php
    }
    echo '</div>';
    }
    ?>

    I hope this helps someone

  3. #3
    Join Date
    May 2012
    Posts
    137
    Plugin Contributions
    0

    Default Re: How to give attributes their own colum in the shopping cart?

    Another question: Does anyone know how I edit the placement of the new attribute values so they align with all the other text in the shopping cart? All the other text has a small space above it, before the shopping cart header.

  4. #4
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: How to give attributes their own colum in the shopping cart?

    You'll have to style that class in your added code, the one called "cartAttribsList". Just add that class to the bottom of your stylesheet.css and apply perhaps margin-top to it.

    Rob

  5. #5
    Join Date
    May 2012
    Posts
    137
    Plugin Contributions
    0

    Default Re: How to give attributes their own colum in the shopping cart?

    Thanks for the response. That did not work. here is what I put and nothing happened:

    .cartAttribsList {
    margin-left: 1em;
    margin-top: 1em;
    }

  6. #6
    Join Date
    May 2012
    Posts
    137
    Plugin Contributions
    0

    Default Re: How to give attributes their own colum in the shopping cart?

    Figured it out. I used padding instead.

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

    Default Re: How to give attributes their own colum in the shopping cart?

    Since you have made the cartAttribsList items a <th> element, you cannot apply margin to them with CSS. You would need to use HTML attributes. These are not headings but items in a set, and should probably be divs instead of <th>, or maybe <td>. In any case, the bare <th> inside a div instead of in a <table><tbody> set is invalid HTML. So if you changed

    <th class="cartAttribsList"><?php echo nl2br($value['products_options_values_name']); ?></th>

    to

    <div class="cartAttribsItem"><?php echo nl2br($value['products_options_values_name']); ?></div>

    or possibly

    <td class="cartAttribsItem"><?php echo nl2br($value['products_options_values_name']); ?></td>
    with a table structure around the set

    you should be okay in all senses, though I am not certain without testing how this nesting sequence would lay out by itself; it might need CSS styling to work right.
    Last edited by gjh42; 18 Jun 2012 at 03:09 AM.

  8. #8
    Join Date
    May 2012
    Posts
    137
    Plugin Contributions
    0

    Default Re: How to give attributes their own colum in the shopping cart?

    It seems to be working properly but if I see anything odd, then I will have to reconsider with your suggetsions. As you can probably see, I have no idea what I am doing here. It was just a lot of guessing, changing code, seeing what happened, being incorrect, then start guessing again.

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

    Default Re: How to give attributes their own colum in the shopping cart?

    Most browsers will be able to compensate for your invalid HTML, but all browsers handle errors in their own way, and you might see slightly different behavior between browsers.

 

 

Similar Threads

  1. Link the subcategory to their respective product listing in shopping cart page
    By newbie456 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 12 Dec 2011, 12:08 AM
  2. Replies: 2
    Last Post: 24 Jun 2010, 11:20 PM
  3. Replies: 1
    Last Post: 28 Nov 2008, 09:02 PM
  4. How do I put the shopping cart buttons on my own website?
    By creativegal51 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 8 Nov 2008, 05:28 AM
  5. EZ pages to enable the right colum or left colum
    By Axel1 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 19 Nov 2006, 10: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