|Data Accessing Methods from Within Various Scopes|
joomla template, virtuemart, phpBB styles, virtuemart, drupal theme, virtuemart, phpBB styles, virtuemart, mootools, virtuemart, phpBB styles, virtuemart, drupal theme, virtuemart, phpBB styles, virtuemart, jQuery, virtuemart, phpBB styles, virtuemart, drupal theme, virtuemart, phpBB styles, virtuemart, mootools, virtuemart, phpBB styles, virtuemart, drupal theme, virtuemart, phpBB styles, virtuemart
This ongoing article is meant to be a reference for basic data-fetching tasks in the Mage environment as well as a learn-by-example tutorial. Please add to it as you can...
Accessing a Product in the Cart
An extension of Mage_Payment_Model_Method_Abstract (payment module Model) or anywhere with an getOrder() method
Mage_Catalog_Model_Product of an item in the cart
Gets the Mage_Catalog_Model_Product of the first item in the cart...
An “item” is another class altogether and lacks methods for returning a product or accessing things like custom product attributes.
Accessing the Value of a Product's Custom Attribute
Value of a product’s custom attribute as set by an administrator in the backend
Mage implements dynamic methods for its (custom) attributes. There are four methods you can use for an attribute: get, set, uns (unset), and has. (see lib/Varien/Object.php, __call() method) To use them, just add the action to the attribute code. For example, using the code “my_attribute_code” - which becomes “MyAttributeCode”, you can call:
Accessing the Text of a Custom Attribute's Dropdown
Text of a dropdown option selected by an administrator for a custom product or category attribute (i.e. “Text” in Text)
Magento assigns enumerated integers for an attribute’s dropdown/select box’s values depending on how many options there are in total and what order they are in on the page, i.e. its a bit arbitrary as the value assigned to each option depends on what order you created the custom attributes. Use this code to get the literal value displayed to the admin user.
Recommended Web Hosting For Bloggers and Designers
I recoomended Webhostings for Bloggers and Designers because I am freelancer, working with thousand clients in the worlds. Most of them will use those hosts.
- Fast, Reliable, Affordable
- 100% Satisfaction Guarantee
- And More...