문제

을 만들었으면 하는 문제에 배송 페이지입니다.는 경우 특성"직접 배달"은 진정한 다음 그것은 오류 메시지를 표시하고 표시하지 않기 바랍니다.를 두고 있는 경우 문이 아래.

<?php $quote = Mage::getSingleton('checkout/session')->getQuote();
        $cartItems = $quote->getAllVisibleItems();

        foreach ($cartItems as $item)
        {
            $productId = $item->getProductId();
            $product = Mage::getModel('catalog/product')->load($productId);
                   if($product->getData('direct_delivery_product')==1){?>

             <div class="direct_message">
             <?php echo 'You have direct delivery products in your shopping cart. This means it may take longer than the standard 2-5 working days to deliver.';?></div>

                <?php unset($_shippingRateGroups["freeshipping"]);
                 break;
             }

                }

?>

그러나 나의 바구니에 페이지가 표시되는 곳에는 총 그것은 여전히 말한 배송은 무료입니다.나도 추가하면 내면 문 템플릿 파일을 표시하지 않았다.누군가가 할 수 있는 방법을 말해 내가 그것을 얻을 수 있는 표준 배송료는 대신 무료 배송입니다.는 경우 특성은 사실이다.이것은 내 템플릿 파일을 보여주는 배달 바구니에 페이지입니다.

<?php if ($this->displayBoth()):?>
<tr>
    <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
        <?php echo $this->getExcludeTaxLabel() ?>
    </td>
    <td style="<?php echo $this->getStyle() ?>" class="a-right">
        <?php echo $this->helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
    </td>
</tr>

<tr>
    <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
        <?php echo $this->getIncludeTaxLabel() ?>
    </td>
    <td style="<?php echo $this->getStyle() ?>" class="a-right">
        <?php echo $this->helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
    </td>
</tr>


<?php elseif($this->displayIncludeTax()) : ?>
<tr>
    <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
        <?php echo $this->getTotal()->getTitle() ?>
    </td>
    <td style="<?php echo $this->getStyle() ?>" class="a-right">
        <?php echo $this->helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
    </td>
</tr>
<?php else:?>


<tr>

    <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
        <?php echo $this->escapeHtml($this->getTotal()->getTitle()) ?>
    </td>
    <td style="<?php echo $this->getStyle() ?>" class="a-right">
        <?php echo $this->helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
    </td>
</tr>
<?php endif;?>
도움이 되었습니까?

해결책

다시 작성할 수 있습니다 무료 캐리어 모델 Mage_Shipping_Model_Carrier_Freeshipping 추가 이 방법 안에 새로운 클래스

public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
{
    $items = $request->getAllVisibleItems();
    foreach ($items as $item) { 
        if ($items->getProduct()->getData('direct_delivery_product')) {
             return false;
        }
    }
}

이 사용하지 않도록 설정해야 합 무료 배송 방법을 때와 제품 direct_delivery_product 설정 예에서 당신의 cart.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top