2013-05-15 43 views
0

有沒有辦法改變產品選項的位置?我想在產品數量下方顯示選項。 我試圖調用app/design/frontend/gallins/default/template/catalog/product/view/addtocart.phtml中的wrapper.phtml,但無法使其正常工作。如何更改產品選項的位置?

我有現在的問題是:

- option 
- qty 
- add to cart button 

但我wan't選項下面數量顯示。

addtocart.phtml - >

<?php $_product = $this->getProduct(); ?> 
<?php $buttonTitle = $this->__('Add to Cart'); ?> 
<?php if ($_product->isSaleable()): ?> 
<div class="add-to-cart"> 
    <?php if (!$_product->isGrouped()): ?> 
     <div class="quantity"> 
      <label for="qty"><?php echo $this->__('Qty:') ?></label> 
      <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /> 
      <div class="clear"></div> 
     </div> 
    <?php endif; ?> 
    <!-- This is where I want to show options --> 
    <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button> 
    <?php echo $this->getChildHtml('', true, true) ?> 
</div> 

我試過<?php echo $this->getChildHtml('wrapper'),但沒有奏效。

+2

和你的代碼在哪裏? – bipen

回答

0

你必須做出2個變化,2個文件,如果你在addtocart.phtml

<?php $_product = $this->getProduct(); 
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes()); 
?> 

<?php $buttonTitle = $this->__('Add to Cart'); ?> 
<?php if($_product->isSaleable()): ?> 
    <div class="add-to-cart"> 
     <?php if(!$_product->isGrouped()): ?> 

     <?php if (count($_attributes) == 0):?> 
     <label for="qty"><?php echo $this->__('Qty:') ?></label> 
     <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /> 
     <?php endif; ?> 

     <?php endif; ?> 
     <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button> 
     <?php echo $this->getChildHtml('', true, true) ?> 
    </div> 
<?php endif; ?> 

有產品選項然後

,並請在選項也改變\像configurable.phtml文件更改下面

<?php 
$_product = $this->getProduct(); 
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes()); 
?> 
<?php if ($_product->isSaleable() && count($_attributes)):?> 
    <label for="qty"><?php echo $this->__('Qty:') ?></label> 
     <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /> 

    <dl> 
    <?php foreach($_attributes as $_attribute): ?> 
     <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt> 
     <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>> 
      <div class="input-box"> 
       <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select"> 
        <option><?php echo $this->__('Choose an Option...') ?></option> 
        </select> 
       </div> 
     </dd> 
    <?php endforeach; ?> 
    </dl> 
    <script type="text/javascript"> 
     var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>); 
    </script> 
<?php endif;?> 

讓我知道,如果我可以幫助你更多。

相關問題