Product template in new Product variotion

boutiquesoncart's picture
boutiquesoncart
Thu, 02/04/2016 - 01:12
#1
Product template in new Product variotion

I haev added a new product variation and supporting content type, but it seems these product type are not themed in theme. 

I have already created a product  node template file for new product. It seem add to cart form template also need to chnaged for this vaiation type.

Please provide me what chnages I need to do in add to cart form template file

khoa's picture
khoa
Thu, 02/04/2016 - 02:34

Hello,

Please send the page that you have problem with it.

Thank you!

boutiquesoncart's picture
boutiquesoncart
Thu, 02/04/2016 - 07:07

Image title

I have added the snapshot here.as this node is not yet published i cant show the page to you to you.as you can see the add to cart form is not shown here properly

khoa's picture
khoa
Thu, 02/04/2016 - 08:34

Hello,

Please give me your website account. Remember to set your message as private.

Thanks!

khoa's picture
khoa
Thu, 02/04/2016 - 15:22

Hello,

I have logged into your site but I can't see the admin menu bar? Or I do not have the privilege?

Thanks!

boutiquesoncart's picture
boutiquesoncart
Fri, 02/05/2016 - 01:02

I didnt get u the admin access.. as this is the live site containing customer data

boutiquesoncart's picture
boutiquesoncart
Fri, 02/05/2016 - 02:19

do u really need admin access to see the page code.

I can see that the template file commerce-cart-add-to-cart-form.tpl.php has bwlow code

i have marked in bold the code which is having issue, here it is limiting the code to work only with variation 'product'. Please let me know what do chnage here to make it work for all product types

<?php
 $product = commerce_product_load((int)$form['product_id']['#value']);
 $query = new EntityFieldQuery;
 $result = $query->entityCondition('entity_type', 'node', '=')
->propertyCondition('type', 'product')
->fieldCondition('field_product_ref', 'product_id', (int)$form['product_id']['#value'], '=')
->range(0, 1)->execute();
  
 $nids = array();
 foreach ($result['node'] as $node) {
$nids[] = $node->nid;
 }
 $node = node_load((int)$nids[0]);
?>
<?php if (isset($form['#is_product_page']) && $form['#is_product_page'] && isset($form['attributes'])): ?>
  <div class="attribute clearfix">
    <?php if (isset($form['attributes'])): ?>
      <fieldset class="attribute_fieldset"> 
        <label class="attribute_label"><?php print t('Color'); ?>:</label>
        <div class="attribute_list"> 
          <ul class="attribute_color">
            <?php foreach ($form['attributes']['field_product_colors']['#options'] as $id => $color) : ?>
              <?php $color = md_orenmode_get_color($id);?>
              <?php if ($id == $form['attributes']['field_product_colors']['#default_value']): ?>
                <li class="active"><a href="#" style="background-color: <?php print $color;?>" data-color="<?php print $id; ?>" class="_<?php print $id; ?>"></a></li>
              <?php else: ?>
                <li><a href="#" style="background-color: <?php print $color;?>" data-color="<?php print $id; ?>" class="_<?php print $id; ?>"></a></li>
              <?php endif; ?>
            <?php endforeach; ?>
          </ul>
        </div>
      </fieldset>
      <fieldset class="attribute_fieldset"> 
        <label class="attribute_label"><?php print t('Size'); ?>:</label>
        <div class="attribute_list">
          <ul class="attribute_size">
            <?php foreach ($form['attributes']['field_product_size']['#options'] as $id => $size) : ?>
              <?php if ($id == $form['attributes']['field_product_size']['#default_value']): ?>
                <li class="active"><a href="#" data-size="<?php print $id; ?>"><?php print $size; ?></a></li>
              <?php else: ?>
                <li><a href="#" data-size="<?php print $id; ?>"><?php print $size; ?></a></li>
              <?php endif; ?>
            <?php endforeach; ?>
          </ul>
        </div>
      </fieldset>
    <?php endif; ?>
    <div class="js-hide">
      <?php print render($form['attributes']) ?> 
    </div>
  </div>
  <div class="add-to-box clearfix">
    <div class="input-content">
      <label for="qty"><?php print t('QTY'); ?>:</label>
      <div class="qty-box">
        <button class="qty-decrease">        <?php print render($form['quantity']) ?>
        <button class="qty-increase">      </div>
    </div>

    <div class="add-to-cart">
      <div class="js-hide"><?php print render($form['submit']) ?></div>
      <a href="#" class="btn btn-3 text-uppercase"><i class="fa fa-cart-plus"></i> <span><?php print t('Add To Cart'); ?></span></a>
    </div>

    <div class="add-to-user">
      <?php if(user_is_logged_in()) : ?>
      <span class="btn btn-13"><?php print flag_create_link('bookmark', $node->nid); ?></span>
      <span class="btn btn-13"><?php print flag_create_link('compare', $node->nid); ?></span>
      <?php else : ?>
      <a href="<?php print base_path().'user'; ?>" class="btn btn-13"><i class="fa fa-heart-o"></i> <span><?php print t('Add to WishList'); ?></span></a>
<a href="<?php print base_path().'user'; ?>" class="btn btn-13"><i class="fa fa-refresh"></i> <span><?php print t('Add to Compare'); ?></span></a>
      <?php endif; ?>
    </div>
  </div>
<?php endif; ?>

<?php print drupal_render_children($form); ?>

ddr's picture
ddr
Tue, 03/22/2016 - 00:49

Subscribe.

I have new product display (prod_d) and new product variation (prod_v).

Result:

Image title

Where and what needs to change?

khoa's picture
khoa
Fri, 02/05/2016 - 02:40

Hello,

Okay, you can go to admin/structure/types/manage/product/display. Then click on the widget at the right of Product Ref field. And check to "Show attribute widgets even if the Add to Cart form only represents one product."

Thanks!

boutiquesoncart's picture
boutiquesoncart
Fri, 02/05/2016 - 02:57

I already did

boutiquesoncart's picture
boutiquesoncart
Fri, 02/05/2016 - 03:45

I had already made this chnage , but still it is same.

khoa's picture
khoa
Fri, 02/05/2016 - 09:26

Hello,

I need FTP and Website account to check and debug. Please create a test site and send me the accessing info.

Thanks!

khoa's picture
khoa
Tue, 03/22/2016 - 02:49

@Ddr:

Please follow this comment to fix this issue.

http://megadrupal.com/comment/9173#comment-9173

ddr's picture
ddr
Tue, 03/22/2016 - 03:02

This helps only when adding a new variation, but not for new product display and new product variation

ddr's picture
ddr
Tue, 03/22/2016 - 03:10

I need to add 5 product displays that have their own variations

ddr's picture
ddr
Wed, 03/23/2016 - 01:23

I should wait answer?

phuonght's picture
phuonght
Wed, 03/23/2016 - 04:07

Ddr,

Could you send us your site url and admin account by private comment? Please remember to backup first.

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.