Hi,
Currently the add to cart button is always shown. Even when all items are out of stock.
Currently this is hardcoded:
<?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']): ?>
<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>
<?php endif; ?>
<?php print drupal_render_children($form); ?>
Is there a way to replace the add to cart button with out of stock message?
And possible hide the qty-plus and qty-minus buttons.
Thanks for feedback.
Regards
Hello,
1.Is there a way to replace the add to cart button with out of stock message?
=> Open node--product.tpl.php file(sites/all/themes/md_orenmode/template/node), and replace
by
2. And possible hide the qty-plus and qty-minus buttons.
=> Open style.css file(sites/all/themes/md_orenmode/css/front), and add the following css to the bottom of that file
Thanks!
Hi Khoa,
Thanks for your feedback.
Indeed, I was already using this if condition. I would prefer to have this fully automatic based on stock level. If stock > 0 -> show 'add to cart', else 'out of stock'. Is this possible based on the decimal stock number?
Thanks for feedback
changed it to
which did the trick.
Thanks!