Hi all, In my website, some products are not for sale in California. While the user checkouts, I have to do a validation like if the cart has items not for sale in California and user's shipping address is in CAlifornia, prevent user from checking out.
The sale in CA is set from admin side using an 'avl' attribute.
here is the code I use to iterate through the cart and check for the attribute
.....................
$cart = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
foreach ($cart as $_item){
$_product = $_item->getProduct();
//If atleast one product has availability status set to California, then set the flag and break.
if($_product->getResource()->getAttribute('avl')->getFrontend()->getValue($_product) == 'NC'){
$flag = true;
break;
}
......................
Well, now the problem is I'm not able to get the 'avl' value as set from the Admin side.
This code is in local//Checkout/Block/Onepage/Shipping.php
Any idea about how to retrieve the attribute value?
Thanks in advance.