Recently, I’ve developed a cron module script to send scheduled newsletters. During the development, I had to hit a lot of time cron.php to test it, but, of course, I needed to wait at least 1 minute to check the result. That is because 1 minute is the minimum cron interval time.
So, I googled a bit and I found a script to test module models. With minor changes, it also works to test cron scripts:
The script has to be saved in domain/module folder and its direct execution has to be allowed in the app/.htaccess file, removing the deny directives.
Text translations in magento are very easy. You just need to use a syntax in you code like this:
<?php echo $this->__('Text to translate');?>
then in your theme locale folder you have to create a csv file like this:
"Text to translate","Text translated"
Translator.translate('Text to translate')
Then you need to add a jstranslator.xml file in the module:
<mystring translate="message" module="yourmodule">
<message>Text to translate</message>
Mystring should just be an unique tag.
In this way, Magento will use the string from the same csv file used for html text
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.