Recently, I developed a slider to show product details and image in home page. I added a new slider_img product attribute to allow the selection of an image, but if any error had occurred during the image loading process, the whole slider didn’t work at all. I tried several checks using if/else, but the best was using try/catch and logging:
Using try/catch, seems the best option in order to avoid a fatal error and so the slider works fine showing other product details
Check the virtual server configuration AllowOverride parameter. It should be:
or at least
Create an .htpassword file using the command:
htpasswd -c .htpassword username
Add directives to .htaccess file in the root foolder
AuthName "Restricted Access"
Require user username
Check if the .htpassword file is readable by Apache user (www-data)
Restart the webserver
Action method RemoveLinkByName, easily removes unwanted links from the navigation sidebar.
I was working on a bootstrap template that uses the same product view template for a
quickview in home page.
My client needed to remove some blocks from the quickview layout, so I used the remove method in the xml file. I was able to remove everything except the reviews because they were rendered by this function:
instead of the usual
So I removed that function from the main product view and I used a wrapper block called product.info.review_custom. Then, using:
I hope there are any drawback using this workaround.
In previous post, I added the the attribute event_date_time to catalog. I needed to add that attribute as field in a tab extension. So I added this code in the tab script to get it. The first line is the most important to tell to Magento that the field should have the time too.
$dateTimeFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('event_date_time', 'datetime', array(
'label' => $hlp->__('Event date'),
'title' => $hlp->__('Event date'),
'time' => true,
'name' => 'product[event_date_time]',
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'format' => $dateTimeFormatIso,
'required' => true,
Use this code in an installer or upgrade script. The backend key is the most important otherwise the time is not saved at all.
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_product', 'event_date_time', array(
'group' => 'Deal Info',
'input' => 'datetime',
'type' => 'datetime',
'time' => true,
'label' => 'Event date',
'backend' => "eav/entity_attribute_backend_time_created",
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => true,
'filterable' => false,
'comparable' => false,
'visible_on_front' => true,
'visible_in_advanced_search' => false,
'is_html_allowed_on_front' => false,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,