Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default I would like to restrict cart image to products with no attributes

    I have been sucessfully using the information in post #8
    http://www.zen-cart.com/forum/showthread.php?t=74524
    to show the correct attribute image in my cart. I have configuration>images>Image - Shopping Cart Status
    set to 0 (if I turn it on I get two images on a product that has attributes, the main product image and the attribute image)

    I need to know how to allow the main product image only if there are no attributes involved with the product.

    I can turn the switch back on if there is a way to stop showing the main image IF there is an attribute.

    Otherwise I can leave the switch off and put the appropriate code in the correct file, I suspect this would be the tpl_shopping_cart_default.php file.

    Can anyone suggest an if type statement that I can use and possibly where in the code I would need to put it to restrict the main product image shown in the cart to only be rendered if there are no attributes involved with the product.

    Thanks for any help you can offer.

  2. #2
    Join Date
    Feb 2010
    Posts
    154
    Plugin Contributions
    0

    Default Re: I would like to restrict cart image to products with no attributes

    You could try this instead of the last line suggested in post #8 in the other thread...

    <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . ($value['attributes_image']=="")? zen_image(DIR_WS_IMAGES . $product['productsImage']) : zen_image(DIR_WS_IMAGES . $value['attributes_image']); ?></li>


    Here's the code block...
    Code:
    <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . ($value['attributes_image']=="")? zen_image(DIR_WS_IMAGES . $product['productsImage']) :  zen_image(DIR_WS_IMAGES . $value['attributes_image']); ?></li>
    I've no idea if this will work as I don't have attributes to test it with, but it basically checks to see if an attribute_image has been specified. If it hasn't then it tries to display the main productsImage instead.

  3. #3
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default Re: I would like to restrict cart image to products with no attributes

    Thanks, but that just causes the main picture to still exist and my attribute image to be a red x.

    I am actually using this:


    <?php echo nl2br($value['products_options_values_name'] . '<br /><br />' . TEXT_OPTION_DIVIDER . zen_image(DIR_WS_IMAGES . $value['attributes_image'])); ?>


    instead of :

    <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . zen_image(DIR_WS_IMAGES . $value['attributes_image']); ?></li>


    The differences on that are irrelevant as far as the images are concerned.

  4. #4
    Join Date
    Feb 2010
    Posts
    154
    Plugin Contributions
    0

    Default Re: I would like to restrict cart image to products with no attributes

    Try this line instead, I had the close bracket in the wrong place in my original post...

    Code:
    <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . ($value['attributes_image']=="" ? zen_image(DIR_WS_IMAGES . $product['productsImage']) :  zen_image(DIR_WS_IMAGES . $value['attributes_image'])); ?></li>

  5. #5
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default Re: I would like to restrict cart image to products with no attributes

    I am sorry I did not see what you posted until now. I will save this post so I can try the syntax if something similar comes up again. I appreciate your help very much.


    I had already ended up changing the file a lot by using the information in post 7 here http://www.zen-cart.com/forum/showth...+shopping+cart

    To anyone with this issue please note I had to remove a ?> to get it to work due to my products with attributes stock add on. I was more or less there twice.

  6. #6
    Join Date
    Jun 2011
    Location
    California
    Posts
    63
    Plugin Contributions
    0

    Default Re: I would like to restrict cart image to products with no attributes

    The post 7 http://www.zen-cart.com/forum/showth...+shopping+cart has an error at the line 89 part. It should be as the fallowing script

    Code:
    <?php
    if (isset($product['attributes']) && is_array($product['attributes'])) {
    echo '';}else{
    echo '<span id="cartImage" class="back">'.$product['productsImage'].'</span>';} ?>

 

 

Similar Threads

  1. v150 Would like to be able for customer to download pdf's with out the cart option turned
    By dekalb in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 9 Jan 2013, 05:42 AM
  2. Add 'Would you also like to purchase...' to other products using attributes?
    By bonheddwr in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 4 Mar 2010, 04:16 PM
  3. Would like to attribute image layout order
    By canemasters in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 1 Aug 2007, 08:50 PM
  4. Would like to click on thumnail & a pop up comes up with bigger image please
    By angelicdezigns in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Jun 2006, 12:34 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