Magento product custom options to be positioned below the price - magento

I would like my Magento product custom options to be positioned below the price. I tried moving the blocks in catalog.xml file but nothing worked.
I did flush all cache every time.

This can be done from within the manage product section in admin. Under design, set "Display Product Options In" > "Product Info Column"

This function can be found in
/app/design/frontend/your_package/your_theme/template/catalog/product/view.phtml
or, if it's not there, look in
/app/design/frontend/your_package/default/template/catalog/product/view.phtml
If the file is not present, then create it by copying from
/app/design/frontend/base/default/template/catalog/product/view.phtml
or, if you are on the Enterprise Edition, from:
/app/design/frontend/enterprise/default/template/catalog/product/view.phtml
Remember not to touch anything in the /app/design/frontend/enterprise/default/
The code responsible for showing prices is:
<?php echo $this->getChildHtml('tierprices') ?>
You have to move the code responsible for showing the options, that looks like this:
<?php if (!$this->hasOptions()):?>
<div class="add-to-box">
<?php if($_product->isSaleable()): ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php endif; ?>
<?php echo $this->getChildHtml('addto') ?>
</div>
<?php else:?>
<?php if ($_product->isSaleable() && $this->hasOptions() && $this->getChildChildHtml('container1') ):?>
<div class="options-container-small">
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
</div>
<?php else: ?>
<?php echo $this->getChildHtml('addto') ?>
<?php endif;?>
<?php endif; ?>
directly below the code that's responsible for prices. Remember that the code above is an example, it may look different in your template, so don't copy-paste it.
Anyway, the file responsible for showing prices is usually /app/design/frontend/your_package/your_theme/template/catalog/product/view/tierprices.phtml (with the same fallbacks as usual), but you shouldn't modify it in your case.

You can change them by edit template (.phtml) file:
app/design/frontend/{default}/{default}/catalog/product/view.phtml

Modify the template Or ovverride it in your theme !
/app/design/frontend/base/default/template/catalog/product/view.phtml
This is where the price is :
<?php echo $this->getTierPriceHtml() ?>
This means customer options showing between this if (){}
<?php if (!$this->hasOptions()):?>
So you can move them as you like in the template file ! or you can style them with CSS to put them at custom position !

Related

Magento: How to show custom attribute on product page below description

I have a custom attribute for products in which I add a video URL.
I made this Embed video responsive using css.
Now I want to call the custom attribute on the product page, so it shows the video.
The file responsible for this is: description.phtml
I've tried the following:
?>
<?php $_description = $this->getProduct()->getDescription(); ?>
<?php if ($_description): ?>
<h2><?php echo $this->__('Details') ?></h2>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
</div>
<div class="std">
<?php echo $_product->getAttributeText('video') ?>
</div>
<?php endif; ?>
But I get the error:
Fatal error: Call to a member function getAttributeText() on a non-object in /data/web/public/app/design/frontend/base/default/template/catalog/product/view/description.phtml on line 40
The video does show however. I'm probably doing this all wrong. Can I fix this with a simple edit of the code, or do I have to use an entirely different approach?
Thanks.
<?php echo $this->getProduct()->getAttributeText('video'); ?>
Try this. Or on top of document add this
<?php $_product = $this->getProduct(); ?>

add description grid list on theme mobile shoppe

i try to add "short description" on my category list of my products but nothing happend on my list.phtml
i try on: app/design/frontend/base/default/template/catalog/product/list.phtml
in my lit view are there this code:
(and i copy this code to grid block but nothing happend)
<div class="desc std">
<h1>test</h1>
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
<?php echo $this->__('Learn More') ?>
</div>
Go to Catalog->Attributes->Manage attributes, search for the short_description attribute, edit it and set the field Used in product listing to Yes. Reindex everything and it should work.
[EDIT]
Or you can simply use this:
<?php echo $_product->getShortDescription();?>

Magento: textbox instead of multi select in layered navigation

Is there a possibility in Magento to have a multi-select attribute, for which I would use a textbox in layered navigation instead of showing all items from multi-select?
I have an attribute where I will have hundreds of options and need to use it in layered navigation.
When customer uses invalid value, an error should show up.
Edit: After the help from FlorinelChis I have folowing code in filter.phtml:
<ol>
<?php foreach ($this->getItems() as $_item): ?>
<?php
$attributeModel = $this->getAttributeModel();
$attribute_code = $attributeModel->getAttributeCode();
?>
<li>
<?php if ($attribute_code != 'available_zip'): ?>
<?php if ($_item->getCount() > 0): ?>
<?php echo $_item->getLabel() ?>
<?php else: echo $_item->getLabel() ?>
<?php endif; ?>
<?php if ($this->shouldDisplayProductCount()): ?>
(<?php echo $_item->getCount() ?>)
<?php endif; ?>
<?php endif; ?>
</li>
<?php endforeach ?>
</ol>
<?php
if ($attribute_code == 'available_zip'):
$cat = Mage::registry('current_category')->getUrlPath() ;
$url = Mage::getBaseUrl();
/*$sendUrl = $this->urlEscape($_item->getUrl()).'+'.$url.$cat.'?'.$attribute_code.'='.$_item->getValue();*/
echo '<form action="" method="get">';
echo '<input type="text" size="5" maxlength="5" name="'.$attribute_code.'" />';
echo '<button type="submit">OK</button>';
echo '</form>';
endif; ?>
I have one more thing now:
how to send the form with attribute id instead of value?
First, let's find out how Magento displays the filters in left hand navigation
1) Enable Template Path Hints:
and here is the result:
2) Let's take a look at app/design/frontend/base/default/template/catalog/layer/filter.phtml (you should copy this file in your theme folder structure)
3) The block ($this in the template file is an instance of Mage_Catalog_Block_Layer_Filter_Attribute which extends Mage_Catalog_Block_Layer_Filter_Abstract)
4) You can see that in Mage_Catalog_Block_Layer_Filter_Abstract a getName() method exists, so you could rely on this function to identify when you attribute is displayed. Don't! The label can change and your code won't be useful any more.
Back to our template file, you can get the attribute_code (which is reliable)
//$this is instance of Mage_Catalog_Block_Layer_Filter_Attribute
$attributeModel = $this->getAttributeModel();
$attribute_code = $attributeModel->getAttributeCode();
5) On your template you can have a check based on attribute code, so you display either the standard list or your custom html code with a textarea instead of a huge list.

Need help using "if" and "empty" and "echo" Magento

Sorry I'm only self taught but having trouble with something.
I currently have a custom attribute that I'd like to echo a price only if the attribute has no value. This is what I have right now but it calls both at the moment. This is for the product list.phtml page. Have been experimenting for the past 3 hours and can't figure how to do it.
<div class="product-pricerange" id="product-pricerange">
<?php echo $_product->getResource()->getAttribute('pricerange')->getFrontend()->getValue($_product) ?>
</div>
<?php echo $this->getPriceHtml($_product, true) ?>
Thanks in advance as any help is much appreciated.
You should be able to achieve this by wrapping it up in an IF statement a bit like so:
<div class="product-pricerange" id="product-pricerange">
<?php if(!$_product->getData("your_attrubute")):?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php endif;?>
</div>
HTH
You could also use hasData() functionnality
<div class="product-pricerange" id="product-pricerange">
<?php if($_product->hasPricerange()):?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php endif;?>
</div>

Magento - Display Attribute Admin Title

How do I modify the following code block so that it will display ‘Plant Genus’ instead of the text ‘[hide]’
The relevant code is at:
\app\design\frontend\enterprise\style\template\catalog\layer\view.phtml
<?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<dt><?php echo $this->__($_filter->getName()) ?></dt>
<dd><?php echo $_filter->getHtml() ?></dd>
<?php endif; ?>
<?php endforeach; ?>
Here is the attribute from the admin panel:
#Lucasnus - I dont think this is in the front end, but he has placed the attribute for us to see in a screen shot, the code he quoted is from the front end view.
However I think you are quite close to a solution, since this looks like a store attribute visibility issue.
In the admin panel if you change to the "Garden Store" scope, can you try to then change the attribute value to "Plant Genus" ?
If that does not work, maybe try the Main Website scope.
Do you have this problem with other products attributes?

Resources