create a 2nd store product type - image doesn't load - need help with node--shop-product.tpl.php

dalearyous's picture
dalearyous
Thu, 12/15/2016 - 15:17
#1
create a 2nd store product type - image doesn't load - need help with node--shop-product.tpl.php

so if i create a second store product type (not a content type but store product type) and add product based on that the thumbnail and picture for that product does not load. i suspect because the node--shop-product.tpl.php file does not have any variables in there accounting for whatever you named the image filed for your new store product type. what do i have to do to fix this?

phuonght's picture
phuonght
Thu, 12/15/2016 - 23:26

Hi,

You can please customize manager settings of your display product similar to product display default

https://i.imgur.com/6o54MVq.png

dalearyous's picture
dalearyous
Sun, 12/18/2016 - 13:11

thats actually not true. for the image to load you have to edit the node--shop-product.tpl.php file and add a section of code for every different product image:

<?php if (isset($content['product:field_WHATEVER'])):?>
          <a href="<?php print $node_url; ?>">
            <?php if (isset($content['product:field_WHATEVER']['#items'][1]['uri'])): ?>
              <img src="<?php print image_style_url('product_modal',$content['product:field_WHATEVER']['#items'][0]['uri']); ?>" alt="product" class="current">
              <img src="<?php print image_style_url('product_modal',$content['product:field_WHATEVER']['#items'][1]['uri']); ?>" alt="product">
            <?php else :?>
              <img src="<?php print image_style_url('product_modal',$content['product:field_WHATEVER']['#items'][0]['uri']); ?>" alt="product" class="current">
            <?php endif; ?>
          </a>
        <?php endif; ?>

<?php if (isset($content['product:field_WHATEVER'])): ?>
          <div class="product-slider-wrapper thumbs-bottom">
            <?php print render($content['product:field_image_fusion4x4']); ?>
          </div>
        <?php endif; ?>

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.