I have found that it is very useful to be able to get attributes from the system and use them in places other than a products category page. I always forget the exact syntax to use so, this is going to be my unofficial cheat sheet.
This is how to get a drop down lists options.
$_product_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();
foreach($_product_images->getItems() as $_product_image) echo $_product_image->getUrl();
// or
foreach($_product_images->getItems() as $_product_image)
echo '<img src="'.Mage::helper('catal… Read More
I just wandering on how I can get the configuration data for my custom module. The configuration can be set from the admin system->configuration and how to pull it in frontend?
解决:
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName');
sectionName, groupName and fieldName are present in etc/system.xml file of your module.
The… Read More
Looks like an issue with form-key
Go to app/design/frontend/[Your-package]/[Your-theme]/template/customer/form/login.phtml and template/persistent/customer/form/login.phtml and under
Find: <ul class=”form-list”>
And paste this right after the code above the following:
<input name="form_key" type="hidden" value="<?ph… Read More
// Check if any customer is logged in or not
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
// Load the customer's data
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customer->getPrefix();
$customer->getName(); // Full Name
$customer->getFirstname(); // First Name
$customer->g… Read More
The structure of a Magento theme
The files in a Magento theme are divided into two main directories: app and skin, as shown in the following screenshot:
The following is the description of the two directories:
app: The app/design/frontend/base/default/ directory contains the layout, translation, and template files
skin: The skin/frontend/base/defa… Read More