add description grid list on theme mobile shoppe - magento

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();?>

Related

How do I add pages to menu?

I am new to Magento; now I am trying to develop a simple example site.
My question is this: how can we add pages to main menu?
create one static block with "Your page name"
Create new category with display mode "Static block only" and "include in navigation menu = YES" and select your cms block and save category. And see in front-end side this will be added in navigation item.
Here is the official Magento recommendation on how to do this: http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar
To add a CMS page link to top navigation the hard way, you should override /mnt/www/x1886/app/design/frontend/default/default/template/catalog/navigation/top.phtml.
There are plenty tutorials out there about how to override files in Magento.
Change a change where I placed a comment:
<div class="header-nav-container">
<div class="header-nav">
<h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4>
<ul id="nav">
<!-- ADD ADDITIONAL LINKS HERE -->
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
</ul>
</div>
<?php echo $this->getChildHtml('topLeftLinks') ?>
</div>

Product category name on product viewing page

I'm working on a website. Upon clicking the product it shows all the details of it. But my client want me to show parent category of categroy of the product at top, above the image. Please help me about it. I'm a budding developer.
Try this may be help someone else.
<?php $_helper = $this->helper('catalog/output');?>
<?php $_category_detail=Mage::registry('current_category');?>
<?php $_category_detail->getName();?>
<?php $_category_detail->getId(); ?>
You can get the category data from your product object: $_product->getCategory()->getName();. You will have to edit the template at template/catalog/product/view.phtml. In the template file look for <div class="product-img-box"> and add:
<div class="product-img-box">
<h4><?php echo $_product->getCategory()->getName(); ?></h4>
<?php echo $this->getChildHtml('media') ?>
</div>

magento: how to show custom attributes from general tab in front page automatically

when we upload one product, there is a default attribute set "Default", and in the general tab, there are many default attributes like below image:
well, i added one more custom attribute named "size", when i drag 'size' to general tab on the left, that mean the product has one more attribute. if i want to show the size attribute in the product view page of front end page, i have to put the code: "$_product->getAttributeText('size')", if i added lots of custom attributes, i have to put lots of codes manually. so, my question is how i can show all custom attributes automatically instead of adding one by one manually ?
This is allready done by magento.
Mark your attributes as vissible in frontend and thats it.
Have a look at the template attributes.phtml in path app/design/frontend/yourtheme/default/template/catalog/product/view
<?php if($_additional = $this->getAdditionalData()): ?>
<!--h2><?php echo $this->__('Additional Information') ?></h2-->
<div class="data-table accordion" id="product-attribute-specs-table">
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
<div class="clearer <?php echo $this->htmlEscape($this->__($_data['label'])) ?>">
<div class="trigger"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></div>
<div class="triggerContent" style="display: none;"><span><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></span></div>
</div>
<?php } ?>
</div>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
You need to copy the default file from /app/design/frontend/base/default/template/catalog/product/view to your theme directory
/public_html/app/design/frontend/default/yourtheme/template/catalog/product/view

Magento product custom options to be positioned below the price

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 !

Display only in stock options for configurable products on catalog pages in Magento

I've managed to add options to configurable products on my catalog pages using the code found here: http://www.magentocommerce.com/boards/viewthread/21039/P45/#t167724. What I'd like to do now is only show the options that are available according to the stock of the simple product that the option is coming from.
For example, if I have a t-shirt (configurable product) that has various colors (simple products) and my red color is out of stock, red wouldn't be shown as an option when the configurable product is displayed.
What's the best way to do this?
Update:
For the sake of clarity, here is the relevant block of code from the link I posted.
<?php if($product->getTypeId() == "configurable"): ?>
<?php $attValConfig = $product->getTypeInstance()->getConfigurableAttributesAsArray(); ?>
<?php if(sizeof($attValConfig)): ?>
<?php foreach($attValConfig as $attValConfigSingle): ?>
<fieldset class="product-options" id="product-options-wrapper">
<label><?php echo $attValConfigSingle['label']; ?>:</label>
<select name="super_attribute[<?php echo $attValConfigSingle['attribute_id'] ?>]" id="attribute<?php echo $_product->getId() ?>" class="required-entry super-attribute-select">
<?php foreach($attValConfigSingle['values'] as $attValConfigSingleVal): ?>
<option value="<?php echo $attValConfigSingleVal['value_index'] ?>"><?php echo $attValConfigSingleVal['label'] ?></option>
<?php endforeach; ?>
</select>
</fieldset>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
Since this code is simply getting all of the configurable options and displaying them, it doesn't check to see if the simple product that backs the configurable option is in stock. How do I do this?
I just wondering why we are checking the quantity for stock status why dont't we look on stock availability of simple products.
I have achieved to show out of stock on configurable product according to stock status.
Now you can make product "out stock" and "in stock" through stock availability attribute of simple product.
Try the following ( do what you want returning result ) :
$_productCollection = Mage::getModel('cataloginventory/stock_item')->getCollection()
->addIdFilter($productId) // this line is wrong, don't care this
->addFieldToFilter('qty', array('gteq' => 1));

Resources