Obtención de productos a aparecer si el cliente no ha alcanzado la entrega gratuita cantidad

magento.stackexchange https://magento.stackexchange.com//questions/31586

  •  11-12-2019
  •  | 
  •  

Pregunta

Quiero conseguir un par de productos para mostrar si un usuario no ha llegado a nuestra entrega gratuita de destino (£75 excluyendo el IVA), así que he intentado escribir en una instrucción IF en mi carrito de la compra.phtml archivo, sin embargo, yo no soy grande en la codificación, pero me hizo darle una oportunidad, así que si alguien puede ayudarme sería genial.

Este es mi carro.archivo phtml

<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 echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php echo $this->getChildHtml('form_before') ?>
    <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
    <?php echo $this->getBlockHtml('formkey'); ?>
        <fieldset>
            <table id="shopping-cart-table" class="data-table cart-table">
                <col width="1" />
                <col />
                <col width="1" />
            <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                <col width="1" />
            <?php endif ?>
            <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
            <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
                <col width="1" />
            <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
            <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
                <col width="1" />

            <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
                <thead>
                    <tr>
                        <th class="td-image" rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
                        <th class="td-name" rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
                        <th class="td-edit" rowspan="<?php echo $mergedCells; ?>"></th>
                        <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                        <th class="td-wishlist" rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
                        <?php endif ?>
                        <th class="td-price" class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
                        <th class="td-qty" rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
                        <th class="td-price" class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
                        <th class="td-delete" rowspan="<?php echo $mergedCells; ?>" class="a-center">&nbsp;</th>
                    </tr>
                    <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
                    <tr>
                        <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
                        <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
                        <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
                        <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
                    </tr>
                    <?php endif; ?>
                </thead>
                <tfoot>
                    <tr>
                        <td colspan="50" class="a-right">
                            <?php if(Mage::getUrl()): ?>
                                <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button button_white btn-continue" onclick="setLocation('<?php echo Mage::getUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
                            <?php endif; ?>
                            <button type="submit" title="<?php echo $this->__('Update Shopping Cart') ?>" class="button button_white btn-update"><span><span><?php echo $this->__('Update Shopping Cart') ?></span></span></button>
                        </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 row clearfix">
        <div class="grid_4">
            <?php if (!$this->getIsVirtual()): echo '<div class="cart-block cart-shipping">'.$this->getChildHtml('shipping').'</div>'; endif; ?>
        </div>
        <div class="grid_4">
            <div class="cart-block cart-coupon">
                <?php echo $this->getChildHtml('coupon') ?>
            </div>
        </div>
        <div class="grid_4">
            <div class="cart-block cart-total">
                <?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>
    </div>
    <?php echo $this->getChildHtml('crosssell') ?>
</div>

y este es el código que he intentado comprobar si la sub total fue superior 75.00 o no

    <div class="upsell">

    <?php if ($this->__('Subtotal') < 75.00)
        {
         echo "Why not add these products to qualify for Free Delivery";

        }?>
        </div>

Pero eso no funcionó, mi teoría detrás de esto era que $this->__('Subtotal') muestra el subtotal así que pensé que podría pasar en y compruebe si estaba bajo 75.00 aparentemente no (o simplemente lo hice de la manera equivocada).

si usted podría ayudar sería muy apreciada.

Así que para recapitular quiero que mi instrucción IF para tomar en el subtotal, compruebe si el subtotal es bajo 75.00 si es así mostrar un mensaje.

Gracias de antemano.

¿Fue útil?

Solución

Trate de usar Mage::helper('checkout/cart')->getQuote()->getGrandTotal() en su SI en lugar de $this->__('Subtotal').No hay mucho que explicar aquí, pero básicamente se utiliza la etiqueta del precio como la variable de precio.

Usted puede ser que desee para el volcado de la variable i dio primero para ver el formato y el tipo de datos que devuelve, para poder compararlo con su precio.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top