Showing posts with label Magento. Show all posts
Showing posts with label Magento. Show all posts

Tuesday, February 21, 2012

Creating and Displaying Custom Attribute in Magento

0

It is easy and fast in creating and displaying custom attribute in product view. First go to Catalog-->Attributes-->Manage Attributes Then Add New Atrribute After that, go to Manage Attribute Set, then you must include you're created attribute to an attribute set. Drag the attribute from unassigned attribute to the group. If you will go to a certain product which is using that attribute set, you will see you're created attribute in the General Product Information. That's it! Now you will display the custom attribute in product view which is
app/design/frontend/default/name_of_your_theme/template/catalog/product/view.phtml.
This is for using textbox and textareas
getDisplayAttribute() ?>
If you are using underscores, you must remove theme and capitalize the next word. For example, "shoe_color", you must use this instead in calling your attribute name
getShoeColor();
if it is only one word for example attribute name: test
getTest() ?>
This for the using mulitselect and dropdowns
displayAttributeName('attribute_name') ?>
You must declare the actual name of the attribute to show multiselect or dropdown.

Read more

Friday, January 27, 2012

Useful Magento Snippets For Your Next Project

0

useful magento snippets for your next project










Creating and calling custom attribute if textbox or textarea
getAttributeName() ?>
if dropdown
  getAttributeText('shirt_size') ?>

Calling Page Title Anywhere in the PHTML

getBlock('head')->getTitle(); ?>

Display Category Product in Product View

getProduct()->getCategory() ? $this->getProduct()->getCategory()->getName() : 'no category') ?>

Display Short Description

load($_item->getProductId()); echo $custom->getShortDescription(); ?>

Display Grandtotal

formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?>

Read more

 
Design by ThemeShift | Bloggerized by Lasantha - Free Blogger Templates | Best Web Hosting