how to display a message if a product is direct delivery (attribute = yes)

I have an attribute called direct delivery. Is there a way to display a message on the shipping method page tell the customer they have a direct delivery item in their cart. The attribute "direct delivery" is a yes/ no attribute.

thank you

Solutions

on method.phtml file.you need get list of product and check it attribute value yes

$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('attributecode')==1){
             //direct delivery possaible

                }
                }
Tags: Attributes / Shipping / If

Similar questions

How to display yes/no attribute in custom product grid in Magento?
I am creating a new custom product grid which will show a custom yes/no attribute. I have successfully displayed the value of yes no which is saved in database in 0,1 format. But I need yes or no to be shown in data field. I have used below code in my Grid.php Please help guys.
Front end displays 'Only 1 left'... would like it to display 'One of a kind piece' but only for items that have custom attribute one_of_a_kind = Yes
I have already create the one_of_a_kind custom attribute I think I need edit the code in I think I could add an if/else statement that would decide (based on whether one_of_a_kind = yes or = no) whether to type 'Only %s left' or simply 'One of a kind piece!' However... I don't really know how to refer to the attribute... I don't think the system cr...
Display products on home page, with "promotion" attribute set to "yes" - not working
I am trying to display a list of products on the home page. The list of products is the products with the attribute "promotion" with the dropdown value "yes". So far I have tried the following But it just blank and not actually displaying anything.: I have re-used code from my template bought from Template Monster, the code was used to display the ...
How to display Yes/No Attribute on Catalog Page
Typically I can use the following code to display something like an image or a button on a product page when the value of the IF statement is "1" or "true:" However, this does not work on catalog listing pages. The IF statement is ignored. How should this be written to work on catalog listing pages?
Magento 2: Observer Message with Yes/No Button & Functionality
I'm using Magento 2 CE Version 2.1.0. I have a custom attribute called Type with value A or B. User can only add 1 Product of Type A in the Cart. If a user is going to Add Second time Same or Other product of Type A. Then Observer will give a message "This type of product is already exists. Would you like to overwrite?". Able to display a message. ...
Magento 2 custom attribute and show product if attribute YES
its very Urgent I have an attribute called 'show_product' (in the backend of Magento) with two outcomes 'yes' or 'no'. At the moment I'm just echoing the product name on the frontend. However, ideally I'd like to show all product name the attribute value. For example, if 'yes' then show all product, if 'no' then No product. Can anyone please help m...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.