Pregunta

Siempre es un buen enfoque para mostrar cualquier resultado (negativo o positivo) al usuario.

En mi caso, cuando hago clic en el botón 'Obtener cotizaciones' en Mi carrito página y las tarifas están disponibles - está bien.

Pero cuando no hay tarifas disponibles para esa dirección, necesito mostrarle al cliente algo como 'hey, no tasas tio'.

En la medida en que entiendo, debo cavar en el método estimatePostAction y verificar las tarifas manualmente y configurar un mensaje de flash.

Pero me pregunto si hay otro Magento-Way para tener este enfoque?

Gracias por cualquier sugerencia o visión.

¿Fue útil?

Solución

Bueno, finalmente resolví este problema.

Pero no utilicé el concontroller debido a este problema , pero el observador sales_quote_collect_totals_after.

Otros consejos

Solo uso algo similar a:

<?php $_shippingRateGroups = $this->getShippingRates(); ?>
<?php if (!$_shippingRateGroups): ?>
    <p><?php echo $this->__('Sorry, no shipping quotes are available to this address. Please contact us at ' . Mage::getStoreConfig('general/store_information/phone') . ' for a shipping quote') ?></p>
<?php else: ?>
    ...success message...

y nuestra función GetShippingRates se ve algo así:

 public function getShippingRates()
{
    if (empty($this->_rates)) {
        $this->getAddress()->collectShippingRates()->save();
        $groups = $this->getAddress()->getGroupedAllShippingRates();
        /**
        * If no shipping rate is found an error report will be logged containing product and customer information.
        */
        if (empty($groups)) {
            $this->noShipRateError();
        }
        return $this->_rates = $groups;
    }
    return $this->_rates;
}

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