Sometimes there is a requirement to have custom attributes for a category, but it isn’t that straightforward to add, at least not through the GUI. The method, for a text input, is: 1 Create the new attribute via admin, or via SQL using the following: INSERT INTO `eav_attribute` (`entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_input_renderer`, `frontend_label`, `frontend_class`, `source_model`, `is_global`, `is_visible`, `is_required`, `is_user_defined`, `default_value`, `is_searchable`, `is_filterable`, `is_comparable`, `is_visible_on_front`, `is_html_allowed_on_front`, `is_unique`, `is_visible_in_advanced_search`, `is_configurable`, `apply_to`, `position`, `note`, `is_used_for_price_rules`, `is_filterable_in_search`, `used_in_product_listing`, `used_for_sort_by`) VALUES (9, ‘ATTRIBUTE_CODE’, NULL, ”, ‘varchar’, ”, ”, ‘text’, NULL, ‘ATTRIBUTE_NAME, NULL, ”, 0, 1, 0, 0, ”, 0, 0, 0, 0, 0, 0, 0, 1, ”, 1, ‘, 1, 0, 0, 0); Replace ATTRIBUTE_* with your variables. 2 Create the relationship, using the following: Replace 944 with the ID from the attribute above and 5329 with the next incremented ID in eav_entity_attribute INSERT INTO `eav_entity_attribute` (`entity_attribute_id`, `entity_type_id`, `attribute_set_id`, `attribute_group_id`, … Continue reading
Category Archives: Knowledge Base
How to disable WYSIWYG on Magento 1.4
The new WYSIWYG feature is brilliant … for non-developers, but for the rest of us, Magento popping P tags left right and centre is no fun. It can be easily disabled by going to Admin > System > Configuration > Content Management > WYSIWYG Options
Magento 1.4 Install Errors
We imagine there is going to be a few, but here are the ones we have come across so far: 1 Unsupported operand types … Hostname.php Solution: Comment out line +471 in ./lib/Zend/Validate/Hostname.php #$regexChars += include($this->_validIdns[strtoupper($this->_tld)]); 2 Invalid mode for clean Solution: Remove ./app/code/core/Zend/Cache/ 3 Invalid argument supplied for foreach … toolbar.phtml This is due to a change of the way the pagination works, usually that the template is missing the relevant XML block to load and the subsquent PHP call Solution: Create a new file ./template/catalog/product/list/pager.phtml and enter <?php if($this->getCollection()->getSize()): ?> <?php if($this->getLastPageNum()>1): ?> <td class="pages"> <strong><?php echo $this->__(‘Page:’) ?></strong> <ol> <?php if (!$this->isFirstPage()): ?> <li><a href="<?php echo $this->getPreviousPageUrl() ?>"><img src="<?php echo $this->getSkinUrl(‘images/pager_arrow_left.gif’) ?>" alt="<?php echo $this->__(‘Previous Page’); ?>" /></a></li> <?php endif ?> <?php foreach ($this->getPages() as $_page): ?> <?php if ($this->isPageCurrent($_page)): ?> <li><span class="on"><?php echo $_page ?></span></li> <?php else: ?> <li><a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a></li> … Continue reading
Even better WordPress and Magento integration
A few clients have asked for some modifications to the existing Magento and WordPress extension to support additional features, so we are passing them on to you! New updates include: META tag support No more 301 redirects for downloadable content Improved performance META tag support Magento 1.4 Support Minor bug fixes Integrate WordPress and Magento now! http://www.sonassi.com/knowledge-base/magento-knowledge-base/simple-and-effective-wordpress-and-magento-integration/
Quick script to mass enable categories in Magento
Just another easy one if you are looking to enable categories by ID – we usually incorporate this script into our product insertion API, so that it enables a category automatically for a product upon insertion. But it can also be used standalone. This script would be ideal alongside our export Magento category ID script 1 Create a CSV with a maximum of 1 column, with just the Magento category ID. Then save it to ./app/var/import/categoriesToEnable.csv. For examples sake, we will use, "1" "13" "15" 2 Copy the code below into a new file, ./quick_enableCats.php <? define(‘MAGENTO’, realpath(dirname(__FILE__))); require_once MAGENTO . ‘/app/Mage.php’; umask(0); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $file = fopen(MAGENTO . "/var/import/categoriesToEnable.csv", ‘r’); while (($line = fgetcsv($file)) !== FALSE) { $cats = explode(",",$line[1]); foreach ($cats as $cat) { $newcats[$cat] = true; } } // Activate the categories it is in foreach ($newcats as $cat=>$value) { if ($value && !empty($cat)) { try { $_category … Continue reading