Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/mhd-01/www.antoniopedicini.it/htdocs/wp-includes/functions.php on line 3370

Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/mhd-01/www.antoniopedicini.it/htdocs/wp-includes/functions.php on line 3370

Notice: Undefined variable: royal_prettyphoto_tab_url in /home/mhd-01/www.antoniopedicini.it/htdocs/wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php on line 121
Web Developer - Php, Java, Html, Xml |

Remove the review block in #magento

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:

$this->getReviewsSummaryHtml()

instead of the usual getChildHtml() function.

So I removed that function from the main product view and I used a wrapper block called product.info.review_custom. Then, using:

remove name="product.info.review_custom"

worked.
I hope there are any drawback using this workaround.

Difference between addItem and addJs action method in #magento

I had to add a javascript file in a header template. I put it in the default theme node instead of the variation itself and then I used addJs method to load it. I didn’t specify the theme path thinking the Magento fallback mechanism would find it. Instead, it was not loaded and I noticed the full path in the source was root/js. So I tried addItem method and this time it was correctly included in the source, using the standard fallback mechanism.

How to add date and time field in a Magento backend extension

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,
));

Magento date and time attribute field

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');
$installer->startSetup();

$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,
));

My git workflow

  1. create a git user and add shared keys of each developer
  2. create a bare repository using
    git --bare init
  3. create a working repository in the live or development site using
    git init
  4. add the shared remote repository in the live or development site using
    git remote add origin git@server:/path/to/repo.git
  5. push the development or live site to the shared repository using
    git push origin master
  6. clone the shared repo to the local machine

Moving Magento database through phpmyadmin

Magento database uses Innodb as storage engine and uses foreign keys to check the integrity between the tables. So, importing the sql dump will cause an integrity violation and we need to disable the integrity check before the import session.

Before importing the dump file, we need to insert this string at the beginning of the sql file itself:

SET FOREIGN_KEY_CHECKS = 0;

then save the file and eventually gzip it.

We can now proceed to the import process :)

 


Notice: Undefined variable: royal_prettyphoto_tab_url in /home/mhd-01/www.antoniopedicini.it/htdocs/wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php on line 176

Notice: Undefined variable: royal_prettyphoto_text_for_tab in /home/mhd-01/www.antoniopedicini.it/htdocs/wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php on line 176