Questions tagged [if]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
26 views

create block inside transactional emails to solve {{if}} problem

I'm new to magento. The problem that I have is that I want to modify the template of a transactional email. It's basically a return that I want the customer to receive a different email if the ...
2
votes
1answer
23 views

Load css on condition

I need to a CSS file based on customer attribute when the user is logged. How can I do this ? Readed this : https://mage2.pro/t/topic/140 but it's based on backend config.
1
vote
2answers
51 views

Show link only if category has products Magento 1.9

I have code which outputs category images, names and links so that I can use a static block to output all categories within a parent. Currently each image/title is linked even if the category being ...
0
votes
1answer
67 views

Magento : Check if two conditions are true (category view)

I am trying to check if two conditions are true in the Magento category view file. Specifically if parent id = 1 and if category name = Nike. Can someone please suggest how I can update the code ...
0
votes
3answers
116 views

How to get Two Arrays of Categories in if/elseif Statement

I need to show different content on the product pages (view.phtml) Here is the code I have. The first array with the if statement works, it's getting the else if to work that I am having trouble with ...
0
votes
2answers
1k views

Check if product has custom options Magento 2

I want to display some text next to the price of a product if it has custom options. I have placed some code in final_price.phtml but it doesn't show the message on custom option products. Can anyone ...
0
votes
0answers
186 views

Magento 2 display block in product page only when product belongs to specific category

I have a block showing up near the add-to-cart button, but I would like to display it only in some products from specific categories. Can i use something like this? {{conditions_encoded="a:2:[i:1;a:...
0
votes
2answers
3k views

Help with if/else statement

<div class="stock"> <?php if($_product->isSaleable()): ?> <p class="prodstock"><?php echo $this->__('In stock') ?></p> <?php else: ?> &...
0
votes
2answers
58 views

Show icon over images on specific category listing only

I'd like to show an icon only in my 'shoes' category listing page (ID: 3). I've put in place the PHTML which will create the icon in the list.phtml file. But currently it appears in all categories, I ...
0
votes
1answer
39 views

Why can't I call custom if-check on product view?

I've got a (custom) module which allows me to add YouTube video's to a product. I call that module in my local.xml like such: <block type="mymod_catalog/video" name="video" template="catalog/...
1
vote
0answers
39 views

Output Array with Matching IDs

I have 2 collection (customer and subinfo) that pull info from 2 separate database table. both table information are related and i needed to join/merge the info, which i have done. but unfortunately ...
0
votes
1answer
301 views

Adding icon to product listing image based on attribute value

I am trying to place a text icon on relevant product listing images based on an attribute value ('In Stock'). Can anyone tell me where I am going wrong, as I am crashing the page with the current code....
0
votes
1answer
83 views

Show value if customer logged in and customer email is X

I want to show a value on the product page that only an Admin can see. What is the best way to do this? I was thinking of an if statement that checks if I am logged in and also checks my email. It ...
0
votes
1answer
102 views

I need not to show this when one of the bundle products are out of stock

I have the following that shows a bundle of products on the product page: if ($_product->getAttributeText('bundle') == yes && $simplecount > 1): $product_ids = explode(',',$_product->...
0
votes
1answer
49 views

Fetch Category Image

I am attempting to display all sub-categories of a parent category on a static block page (e.g. brands will show all sub-categories such as Adidas, Nike etc.). I am having problems at the moment ...
-2
votes
1answer
172 views

how to add 2 attribute codes in if condition

i am using this code in attributes.phtml : <?php if ($_data['code'] == 'mobile_design') { ?> <td class="data"> <?php $_ageValues = $_product->getAttributeText($_data['code']); $...
0
votes
1answer
381 views

Hide price and add to basket for guests

I'd like to hide the price and add to cart button for guests not logged in to my Magento site. I'd also like to show a 'login or register to view prices' message for guests too. I imagine this will ...
2
votes
6answers
3k views

Call to a member function getName() on a non-object product view page

I have the following code on my product view page, calling the product's containing category title : <div class="page-title category-title"> <h1><?php echo $_category->...
0
votes
3answers
1k views

Show static banner or category banner on product page

I have the following code in product/view.phtml: <?php if(Mage::registry('current_category')): $_category=Mage::registry('current_category'); $_helper = Mage::helper('catalog/...
2
votes
1answer
334 views

Show static image on category if no category banner uploaded

I have the following code that displays my category banner image: <?php $_helper = $this->helper('catalog/output'); $_category = Mage::registry('...
8
votes
1answer
1k views

If Statements in CMS Page

This is what I am trying to do: {{if var data.request_quote=="on"}} Yes {{else}} No {{/if}} Where var data.request_quote is a form variable. It keeps coming out as No, even if data.request_quote is ...
1
vote
1answer
92 views

Other way to build bootstrap framework with “else if”?

I have created a page for header.phtml I tried to change old design to new useful design with Bootstrap with my book. But I have a problem in two lines <?php else: ?> <?php endif;?>...
0
votes
3answers
121 views

Echo different text if specific product is in cart or not

I want to show "Text 1", when the Product with the ID 1 is in the cart. I want to show "Text 2", when the Product with the ID 1 is NOT in the cart. My code already works for "Text 1". This Text is ...
0
votes
1answer
48 views

Last class is not setting on last category in Array

We have an If statement which sets a class name to categories in the array, The first category has the class of "first" and the last category has the class of "last" however the Last class name is not ...
0
votes
1answer
732 views

want to echo a string in the price.phtml

I want to echo a string in my price.html and im using this if statement <?php if($_product->getData('bogof')==1){ echo 'test';} ?> but it doesn't print anything i know ...
2
votes
1answer
2k views

Want to display an Image if a customer group has a special price

I want to display an image in corner of our product images if a customer is logged into a specific group and that group has a special price. I have got the code for checking whether a customer is ...
1
vote
1answer
6k views

Checking if a product has an attribute set to yes

I have an attribute called BOGOF. Is there a way to display a pic on just to show the item is a buy one get one free item. The attribute is a yes/ no. Someone has given me this code in the past but ...
0
votes
1answer
229 views

how to disable free shipping if an attribute is true

I have created an if statement which I have on my shipping page. Where if the attribute "direct delivery" is true then it will display an error message and not show free delivery. I have put the If ...
0
votes
1answer
313 views

if statement display the error message more than once

i have a check in my checkout to see if a product has the attribute direct delivery set to yes and if so it should display a message. However if there is more than one product in the basket with the ...
2
votes
1answer
61 views

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 ...
3
votes
1answer
4k views

Need to display a warning message if a product from a certain category is in the cart

I need to add a warning message to my shipping methods page in the cart if a product from a certain category has been ordered. for example if our customer order furniture from the category ID 76 ...
1
vote
1answer
270 views

Getting products to appear if customer hasn't reached free delivery amount

I want to get a few products to display if a user hasnt reached our free delivery target (£75 excl VAT) so i tried to write in an IF statement in my cart.phtml file however i am not great at coding ...
0
votes
1answer
3k views

adding a sale image if the product is on sale

I have a table on my home page which shows 5 products from a category, I made called "Recommended For You". This works perfectly fine. The only thing I want to add is if the product has a special ...
0
votes
1answer
1k views

if statement for meta language tag on multi-language site

Going through some SEO lists and found that magento websites do not provide the proper meta language information in the head on all pages. Very simple to correct on uni-lingual websites, modify the ...
0
votes
1answer
1k views

if statement attribute condition & categories condition (2 conditions)

I have a large amount of products, about half do not have a proper description. To address this I've created an if statement that will display the product name one way and if the condition is not met ...