Pergunta

A caixa de entrada de quantidade está faltando nas páginas simples de produtos.Quando ativo as dicas de modelo, vejo muito mais blocos no produto de configuração do que no simples.

Por exemplo, recebo os seguintes blocos na configuração (que contêm a quantidade do produto).

frontend/default/site/template/catalog/product/view/options/wrapper.phtml
frontend/default/site/template/catalog/product/view/type/options/configurable.phtml
frontend/base/default/template/catalog/product/view/options/js.phtml
frontend/default/site/template/catalog/product/view/options.phtml
frontend/default/site/template/page/js/calendar.phtml

Mas de maneira simples, não vejo nenhum desses blocos gerado em dicas de modelo.

Não acho que seja um problema com o xml, pois testei o catalog.xml base e ainda falta a mesma caixa de quantidade.Qualquer insight seria muito útil.Desde já, obrigado.

Originalmente pensei que fosse algo no arquivo options.phtml, mas, novamente, não tenho certeza.

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/* @var $this Mage_Catalog_Block_Product_View_Options */
?>

<?php $_options = Mage::helper('core')->decorateArray($this->getOptions()) ?>
<?php if (count($_options)):?>
    <script type="text/javascript">
    //<![CDATA[
    var optionFileUpload = {
        productForm : $('product_addtocart_form'),
        formAction : '',
        formElements : {},
        upload : function(element){
            this.formElements = this.productForm.select('input', 'select', 'textarea', 'button');
            this.removeRequire(element.readAttribute('id').sub('option_', ''));

            template = '<iframe id="upload_target" name="upload_target" style="width:0; height:0; border:0;"><\/iframe>';

            Element.insert($('option_'+element.readAttribute('id').sub('option_', '')+'_uploaded_file'), {after: template});

            this.formAction = this.productForm.action;

            var baseUrl = '<?php echo $this->getUrl('*/product/upload') ?>';
            var urlExt = 'option_id/'+element.readAttribute('id').sub('option_', '');

            this.productForm.action = parseSidUrl(baseUrl, urlExt);
            this.productForm.target = 'upload_target';
            this.productForm.submit();
            this.productForm.target = '';
            this.productForm.action = this.formAction;
        },
        removeRequire : function(skipElementId){
            for(var i=0; i<this.formElements.length; i++){
                if (this.formElements[i].readAttribute('id') != 'option_'+skipElementId+'_file' && this.formElements[i].type != 'button') {
                    this.formElements[i].disabled='disabled';
                }
            }
        },
        addRequire : function(skipElementId){
            for(var i=0; i<this.formElements.length; i++){
                if (this.formElements[i].readAttribute('name') != 'options_'+skipElementId+'_file' && this.formElements[i].type != 'button') {
                    this.formElements[i].disabled='';
                }
            }
        },
        uploadCallback : function(data){
            this.addRequire(data.optionId);
            $('upload_target').remove();

            if (data.error) {

            } else {
                $('option_'+data.optionId+'_uploaded_file').value = data.fileName;
                $('option_'+data.optionId+'_file').value = '';
                $('option_'+data.optionId+'_file').hide();
                $('option_'+data.optionId+'').hide();
                template = '<div id="option_'+data.optionId+'_file_box"><a href="#"><img src="var/options/'+data.fileName+'" alt=""><\/a><a href="#" onclick="optionFileUpload.removeFile('+data.optionId+')" title="Remove file" \/>Remove file<\/a>';

                Element.insert($('option_'+data.optionId+'_uploaded_file'), {after: template});
            }
        },
        removeFile : function(optionId)
        {
            $('option_'+optionId+'_uploaded_file').value= '';
            $('option_'+optionId+'_file').show();
            $('option_'+optionId+'').show();

            $('option_'+optionId+'_file_box').remove();
        }
    }
    var optionTextCounter = {
        count : function(field,cntfield,maxlimit){
            if (field.value.length > maxlimit){
                field.value = field.value.substring(0, maxlimit);
            } else {
                cntfield.innerHTML = maxlimit - field.value.length;
            }
        }
    }

    Product.Options = Class.create();
    Product.Options.prototype = {
        initialize : function(config) {
            this.config = config;
            this.reloadPrice();
            document.observe("dom:loaded", this.reloadPrice.bind(this));
        },
        reloadPrice : function() {
            var config = this.config;
            var skipIds = [];
            $$('body .product-custom-option').each(function(element){
                var optionId = 0;
                element.name.sub(/[0-9]+/, function(match){
                    optionId = parseInt(match[0], 10);
                });
                if (config[optionId]) {
                    var configOptions = config[optionId];
                    var curConfig = {price: 0};
                    if (element.type == 'checkbox' || element.type == 'radio') {
                        if (element.checked) {
                            if (typeof configOptions[element.getValue()] != 'undefined') {
                                curConfig = configOptions[element.getValue()];
                            }
                        }
                    } else if(element.hasClassName('datetime-picker') && !skipIds.include(optionId)) {
                        dateSelected = true;
                        $$('.product-custom-option[id^="options_' + optionId + '"]').each(function(dt){
                            if (dt.getValue() == '') {
                                dateSelected = false;
                            }
                        });
                        if (dateSelected) {
                            curConfig = configOptions;
                            skipIds[optionId] = optionId;
                        }
                    } else if(element.type == 'select-one' || element.type == 'select-multiple') {
                        if ('options' in element) {
                            $A(element.options).each(function(selectOption){
                                if ('selected' in selectOption && selectOption.selected) {
                                    if (typeof(configOptions[selectOption.value]) != 'undefined') {
                                        curConfig = configOptions[selectOption.value];
                                    }
                                }
                            });
                        }
                    } else {
                        if (element.getValue().strip() != '') {
                            curConfig = configOptions;
                        }
                    }
                    if(element.type == 'select-multiple' && ('options' in element)) {
                        $A(element.options).each(function(selectOption) {
                            if (('selected' in selectOption) && typeof(configOptions[selectOption.value]) != 'undefined') {
                                if (selectOption.selected) {
                                    curConfig = configOptions[selectOption.value];
                                } else {
                                    curConfig = {price: 0};
                                }
                                optionsPrice.addCustomPrices(optionId + '-' + selectOption.value, curConfig);
                                optionsPrice.reload();
                            }
                        });
                    } else {
                        // optionsPrice.addCustomPrices(element.id || optionId, curConfig);
                        optionsPrice.reload();
                    }
                }
            });
        }
    }
    function validateOptionsCallback(elmId, result) {
        var container = $(elmId).up('ul.options-list');
        if (result == 'failed') {
            container.removeClassName('validation-passed');
            container.addClassName('validation-failed');
        } else {
            container.removeClassName('validation-failed');
            container.addClassName('validation-passed');
        }
    }
    var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);
    //]]>
    </script>
    <?php $i = 0; ?>
    <?php $_product = Mage::getBlockSingleton('catalog/product_view')->getProduct(); ?>
    <?php if($_product->getTypeId() == 'simple'){ ?>
        <div class="custom-options-info">
        <!--**************Custom option*************-->
            <?php $heightDecimal = explode(',',$_product->getHeightDecimal()); ?>
            <?php $widthDecimal = explode(',',$_product->getWidthDecimal()); ?>
                <div class="combination-widtth-height">
                    <?php foreach ($_product->getOptions() as $valueCustom) { ?> 
                          <?php if($valueCustom->getTitle() == 'Height'){ ?>
                            <div class="height-option">
                            <label<?php if ($valueCustom->getIsRequire()) echo ' class="required"' ?>><?php if ($valueCustom->getIsRequire()) echo '<em>*</em>' ?><?php echo  $this->htmlEscape($valueCustom->getTitle()) ?></label>    
                                    <input id="put-value-height" onkeyup="putValueHeight('options_<?php echo $valueCustom->getId() ?>_text',this.value)"  type="text"  class="input-text<?php echo $valueCustom->getIsRequire() ? ' required-entry' : '' ?> <?php echo $valueCustom->getMaxCharacters() ? ' validate-length maximum-length-'.$valueCustom->getMaxCharacters() : '' ?> product-custom-option" value="<?php echo $this->escapeHtml($this->getDefaultValue()) ?>" />
                                    <select class="input-text product-custom-option" id="put-value-height-decimal" onchange="putValueHeightDecimal('options_<?php echo $valueCustom->getId() ?>_text',this.value)">
                                        <option value="">0</option>  
                                        <?php foreach($heightDecimal as $hgtDec): ?>
                                            <?php $heightDecimalText = explode('/',$hgtDec); ?>
                                            <?php $heightDecimalInt1 = $heightDecimalText[0]; ?>
                                            <?php $heightDecimalInt2 = $heightDecimalText[1]; ?>
                                        <option value="<?php echo number_format(round(($heightDecimalInt1 / $heightDecimalInt2),3),3); ?>"><?php echo $hgtDec; ?></option>    
                                        <?php endforeach; ?>
                                    </select>
                                    </div>
                                <?php }

                                if($valueCustom->getTitle() == 'Width'){ ?>
                                    <div class="width-option">
                                    <label<?php if ($valueCustom->getIsRequire()) echo ' class="required"' ?>><?php if ($valueCustom->getIsRequire()) echo '<em>*</em>' ?><?php echo  $this->htmlEscape($valueCustom->getTitle()) ?></label>    
                                    <input id="put-value-width" onkeyup="putValueWidth('options_<?php echo $valueCustom->getId() ?>_text',this.value)"  type="text"  class="input-text<?php echo $valueCustom->getIsRequire() ? ' required-entry' : '' ?> <?php echo $valueCustom->getMaxCharacters() ? ' validate-length maximum-length-'.$valueCustom->getMaxCharacters() : '' ?> product-custom-option" value="<?php echo $this->escapeHtml($this->getDefaultValue()) ?>" />
                                    <select class="input-text product-custom-option" id="put-value-width-decimal" onchange="putValueWidthDecimal('options_<?php echo $valueCustom->getId() ?>_text',this.value)">
                                        <option value="">0</option>  
                                        <?php foreach($widthDecimal as $hgtDec): ?>
                                            <?php $heightDecimalText = explode('/',$hgtDec); ?>
                                            <?php $heightDecimalInt1 = $heightDecimalText[0]; ?>
                                            <?php $heightDecimalInt2 = $heightDecimalText[1]; ?>
                                        <option value="<?php echo number_format(round(($heightDecimalInt1 / $heightDecimalInt2),3),3); ?>"><?php echo $hgtDec; ?></option>    
                                        <?php endforeach; ?>
                                    </select>
                                    </div>
                                <?php } ?>

                                <?php } ?>
                          </div>
                            <!--**************Custom option*************-->
    <?php foreach($_options as $_option): ?>
        <?php  
            if($i > 1 && $i % 3 == 2){
//                echo '<div class="custom-options-info">';  ?>

            <?php }
//            if($i == 0){
//                echo '<div class="custom-options-first-info">';
//            }
        ?>
        <?php echo $this->getOptionHtml($_option) ?>
        <?php 
//            if($i > 1 && $i % 3 == 1){
//                echo '</div>';
//            }
//            if($i == 1){
//                echo '</div>';
//            }
            ?>
    <?php $i++; ?>
    <?php endforeach; ?>
        <?php 
//        if($i % 3 != 2){
//             echo '</div>';
//        } 
//        if($i == 1){
//             echo '</div>';
//        } 
        ?>
                            <?php if ($_product->isSaleable()): ?>
        <?php if (!$_product->isGrouped()): ?>
        <?php $prodminqty = $_product->getStockItem()->getMinSaleQty(); ?>
            <div class="prod_quantity">
                <label for="qty"><?php echo $this->__('Quantity') ?></label>
                <input type="text" name="qty" id="qty"  value="<?php echo $prodminqty > 0 ? $prodminqty : 1; ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
            </div>
                        <?php $edge_image = $_product->getEdgeImage() ?>
                <?php if ($_product->getEdgeType() == 1): ?>
                    <div class="edge-link">
                        <a id="edge-box-a"><?php echo $this->__('Outside Edge Image Options'); ?></a>
                    </div>
            <div id='edge-image-none' style='display:none'><img src="<?php echo Mage::getBaseUrl('media') . 'edge_image/' . $edge_image ?>"/></div>
            <div id="edge-image-parent" class='egde-image-class-parent'>
                    <div class="fancybox-item" id="edge-image" style='display:none'>
                            <img src="<?php echo Mage::getBaseUrl('media') . 'edge_image/' . $edge_image ?>"/>
                    </div>
            </div>
        <?php endif; ?>
                    <script type="text/javascript">
                    jQuery(document).ready(function() {
                        jQuery("a#edge-box-a").fancybox({
                            'width': '100%',
                            'height': '100%',
                            'autoScale': true,
                            'transitionIn': 'fade',
                            'transitionOut': 'fade',
                            'type': 'inline',
                            'href': '#edge-image',
                            afterClose: function() {
                                 htmlstart="  <div id='edge-image' class='fancybox-item' style='display:none;'>";
                                 htmlEnd="</div>";
                                jQuery("#edge-image-parent").html(htmlstart+jQuery("#edge-image-none").html()+htmlEnd);
                            }
                        });

                    });
                    </script>

    <?php endif; ?>
        <?php endif; ?>
                            </div>
    <?php }else{ ?>
    <?php foreach($_options as $_option): ?>
        <?php  
            if($i == 0 && strtolower($_option->getTitle()) != 'width' && strtolower($_option->getTitle()) != 'height'){
                echo '<div class="custom-options-info">';
            }
            if($i > 1 && $i % 3 == 2 && strtolower($_option->getTitle()) != 'width' && strtolower($_option->getTitle()) != 'height'){
                echo '<div class="custom-options-info custom-options-info-new">';
            }
//            elseif($i != 0 && $i % 3 == 1){
//                echo '<div class="custom-options-info-new">';
//            }
        ?>
        <?php echo $this->getOptionHtml($_option) ?>
        <?php 
            if($i == 1 && strtolower($_option->getTitle()) != 'width' && strtolower($_option->getTitle()) != 'height'){
                echo '</div>';
            }
            if($i > 1 && $i % 3 == 1 && strtolower($_option->getTitle()) != 'width' && strtolower($_option->getTitle()) != 'height'){
                echo '</div>';
            }

            ?>
    <?php 
    if(strtolower($_option->getTitle()) != 'width' && strtolower($_option->getTitle()) != 'height'){
    $i++;
    } ?>
    <?php endforeach; ?>
     <?php if($i % 3 != 1){
             echo '</div>';
        } ?>
    <?php } ?>

<?php endif; ?>

<?php // Quantity box for config products ?>
<?php $_product = Mage::getBlockSingleton('catalog/product_view')->getProduct(); ?>
    <?php if($_product->getTypeId() == 'configurable'){ ?>
            <div class="prod_quantity">
                <label for="qty"><?php echo $this->__('Quantity') ?></label>
                <input type="text" name="qty" id="qty"  value="<?php echo $prodminqty > 0 ? $prodminqty : 1; ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
            </div>
<?php } ?>
Foi útil?

Solução

Para um produto simples, o campo QTY geralmente está em addtocart.phtml, que é colocado em view.phtml com a chamada <?php echo $this->getChildHtml('addtocart') ?> Eu recomendo que você verifique se você tem o $this->getChildHtml('addtocart') chame seus temas view.phtml e também verifique o arquivo addotcart.phtml de seus temas em relação ao que está em base/padrão.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top