客户无法在Magento中更改/ checkout / cart上的商品数量

时间:2015-08-06 11:02:02

标签: magento magento-1.7 cart shopping



<?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) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Shopping cart template
 *
 * @see Mage_Checkout_Block_Cart
 */
/**
 * - Removed top "checkout" button
 * - Added table wrapper (to show background image)
 * - Changed "continue shopping" button and "update cart" button
 * - Added class 'last' in table header last cells
 * - Rearranged layout of 'cart-collaterals'
 */
?>
<div class="cart">
    <div class="page-title title-buttons">
        <h1><?php echo $this->__('Shopping Cart') ?></h1>
        <?php /* if(!$this->hasError()): ?>
        <ul class="checkout-types">
        <?php foreach ($this->getMethods('top_methods') as $method): ?>
            <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
            <li><?php echo $methodHtml; ?></li>
            <?php endif; ?>
        <?php endforeach; ?>
        </ul>
        <?php endif; */ ?>
    </div>
    <?php if($this->getMessagesBlock()->getMessageCollection()->count()): ?>
      <div id="robin_global_messages" style="display: none">
        <a href="javascript:void(0)" id="robin_global_messages_close" style="display: none" title="<?php echo $this->__('Hide messages') ?>">&times;</a>
          <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
       </div>
      <?php $this->getMessagesBlock()->getMessageCollection()->clear(); ?>
<script type="text/javascript">
//<![CDATA[
Event.observe('robin_global_messages_close', 'click', function() {
Effect.SlideUp('robin_global_messages', { duration: 0.4, delay: 0.3 });
Effect.Fade('robin_global_messages_close', { duration: 0.2 });
});
Event.observe(document, 'dom:loaded', function() {
Effect.SlideDown('robin_global_messages', { duration: 0.4, delay: 0.3 });
Effect.Appear('robin_global_messages_close', { duration: 0.2, delay: 1 });
});
//]]>
</script>
<?php endif; ?>

    <?php echo $this->getChildHtml('form_before') ?>
    <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
        <fieldset>
            <table id="shopping-cart-table" class="data-table cart-table">
                <col class="col-img" width="1" />
                <col />
                <col class="col-edit" width="1" />
            <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                <col class="col-wish" width="1" />
            <?php endif ?>
            <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col class="col-unit-price" width="1" />
            <?php endif; ?>
            <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col class="col-unit-price" width="1" />
            <?php endif; ?>
                <col width="1" />
            <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col class="<?php if($this->helper('tax')->displayCartBothPrices()) echo 'col-total-excl'; else echo 'col-total'; ?>" width="1" />
            <?php endif; ?>
            <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col class="<?php if($this->helper('tax')->displayCartBothPrices()) echo 'col-total-incl'; else echo 'col-total'; ?>" width="1" />
            <?php endif; ?>
                <col class="col-delete" width="1" />

            <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
                <thead>
                    <tr>
                        <th class="col-img" rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
                        <th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
                        <th class="col-edit" rowspan="<?php echo $mergedCells; ?>"></th>
                        <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                        <th class="col-wish a-center" rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
                        <?php endif ?>
                        <th class="col-unit-price a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
                        <th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
                        <th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
                        <th class="col-delete a-center" rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
                    </tr>
                    <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
                    <tr>
                        <th class="col-unit-price a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
                        <th class="col-unit-price"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
                        <th class="col-total-excl a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
                        <th class="col-total-incl"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
                    </tr>
                    <?php endif; ?>
                </thead>
                <tfoot>
                    <tr>
                        <td colspan="50" class="a-right">
                            <?php if($this->getContinueShoppingUrl()): ?>
                                <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
                            <?php endif; ?>
                            <button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
							<?php /*?>
                            <button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
                            <!--[if lt IE 8]>
                            <input type="hidden" id="update_cart_action_container" />
                            <script type="text/javascript">
                            //<![CDATA[
                                Event.observe(window, 'load', function()
                                {
                                    // Internet Explorer (lt 8) does not support value attribute in button elements
                                    $emptyCartButton = $('empty_cart_button');
                                    $cartActionContainer = $('update_cart_action_container');
                                    if ($emptyCartButton && $cartActionContainer) {
                                        Event.observe($emptyCartButton, 'click', function()
                                        {
                                            $emptyCartButton.setAttribute('name', 'update_cart_action_temp');
                                            $cartActionContainer.setAttribute('name', 'update_cart_action');
                                            $cartActionContainer.setValue('empty_cart');
                                        });
                                    }

                                });
                            //]]>
                            </script>
                            <![endif]-->
                            <?php */?>
                        </td>
                    </tr>
                </tfoot>
                <tbody>
                <?php foreach($this->getItems() as $_item): ?>
                    <?php echo $this->getItemHtml($_item) ?>
                <?php endforeach ?>
                </tbody>
            </table>
            <script type="text/javascript">decorateTable('shopping-cart-table')</script>
        </fieldset>
    </form>
    <div class="cart-collaterals nested-container">
    	<div class="cart-right-column grid12-4">
            <div class="totals grid-full alpha omega">
                <div class="totals-inner">
                <?php echo $this->getChildHtml('totals'); ?>
                <?php if(!$this->hasError()): ?>
                    <ul class="checkout-types">
                    <?php foreach ($this->getMethods('methods') as $method): ?>
                    	<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
                    		<li><?php echo $methodHtml; ?></li>
                    	<?php endif; ?>
                    <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
                </div>
            </div>
			<?php if ($tmpHtml = $this->getChildHtml('block_cart_below_totals')): ?>
            	<div class="block_cart_below_totals grid-full alpha omega"><?php echo $tmpHtml; ?></div>
            <?php endif; ?>
        </div> <!-- end: cart-right-column -->
        <div class="cart-left-column grid12-8">
        	<?php if ($tmpHtml = $this->getChildHtml('checkout.cart.extra')): ?>
            <div class="grid-full alpha omega">
                <?php /* Extensions placeholder */ ?>
                <?php echo $tmpHtml; ?>
			</div>
            <?php endif; ?>
            
            <?php if ($tmpHtml = $this->getChildHtml('block_cart_below_table')): ?>
            	<div class="block_cart_below_table grid-full alpha omega"><?php echo $tmpHtml; ?></div>
            <?php endif; ?>
            
			<div class="grid12-6 alpha persistent-grid2-1">
            	<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
			</div>
			<div class="grid12-6 omega persistent-grid2-1 float-right">
            	<?php echo $this->getChildHtml('coupon') ?>
            </div>
            <div class="grid-full alpha omega">
                <?php echo $this->getChildHtml('crosssell') ?>
            </div>
        </div> <!-- end: cart-left-column -->
    </div>
</div>
&#13;
&#13;
&#13;

当客户尝试增加购物车中商品的数量并点击“更新购物车”时 将显示以下错误消息。 方法&#34; updtatePGift&#34;未在&#34; Alin_ProductGift_Model_Observer&#34;中定义。 数量保持不变。

1 个答案:

答案 0 :(得分:0)

找到您调用updtatePGift函数的位置。在您的问题中包含该段代码。

确保/app/code/community/Alin/ProductGift/Model/Observer.php

中存在此类功能

输入错误 updtatePGift 应该是 updtatePGiftA

相关问题