vendredi 24 avril 2015

Magento if product name contains statement

I have set up a complex magneto order email which sends estimated delivery dates to customers when they checkout. However for a specific product category I do not want to echo the estimated delivery date.

I am wondering the best method to do this...

MY first thought was to get category Id from product Id, and then do an if statement to say if category = A do not show code else show code.

I tried using this

$ordered_items = $_order->getAllItems(); 
Foreach($ordered_items as $item){     
$itemId = $item->getItemId(); 
$itemsku = $item->getSku(); 
$catId = $item->getProduct()->getCategoryIds();         
} ?> 

But this just returned "Array" when i try and echo the $catId.

My other thought was to get the product name, and say something like if name contains('sometext'), execute.

1) How do I correctly get the category ID of a product that lies in a single category.

2) How do I do an if statement to say "if product name contains ('sometext')"

Regards, Frank

Aucun commentaire:

Enregistrer un commentaire