Website design Packages.

Affordable Website Designs.

Ecommerce - Content Management.

SEO - Consultancy.

Hosting - Email.

Author Archive

This is one major pain when you discover that magento will not allow you to add custom options to a bundle product.

You need to hack a file or two

app/code/core/Mage/Bundle/Model/Observer.php

comment out the lines

if ($product->getPriceType() == '0' && !$product->getOptionsReadonly()) {
$product->setCanSaveCustomOptions(true);
if ($customOptions = $product->getProductOptions()) {
foreach (array_keys($customOptions) as $key) {
$customOptions[$key]['is_delete'] = 1;
}
$product->setProductOptions($customOptions);
}
}

then

app/design/adminhtml/default/default/template/catalog/product/edit/options.phtml

if ($('price_type')) {
if ($('price_type').value == '0' && $('dynamic-price-warrning')) {
$('dynamic-price-warrning').show();
}
}

Had a small problem with this theme and found a solution on the magento website

Replace the checkout.xml file in:
app/design/frontend/default/hellowired/layout/checkout.xml

with the one from the default Modern theme here:
app/design/frontend/default/modern/layout/checkout.xml

Then flush the cache and refresh all of the items.

Your place order button should then show up.

I have noticed that once you go over twenty thoussand products the login to the admin panel becomes very slow,

what seems to improve the login process is to make a small change to the .htaccess file in the root directory.

If you enable deflation of files by removing the “#” and then restart your apache server the problem seems to be solved

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</IfModule>

magento reindex

by admin | August 12, 2012 | In Magento tips No Comments

to reindex magento froma ssh session cd to your magento root directory and

issue the following command

All you need to do to reindex your Magento data manually is to log in your hosting account via SSH, go to your Magento installation directory (e.g. public_html/store) and execute the following command:

/usr/local/bin/php shell/indexer.php reindexall

There is currently no quick way to delete large quantities of products from the magento admin area!!

If you select a large quantity for deletion the system usually crashes with errors :(

It get around this issue the best solution is to access the database directly through your cpanel

select your magento database and first export the complete database with data in case you run into problems.

you will need to enter the following sql commands in the sql window by selecting the sql tab

Commands for (All products to be deleted) :)

TRUNCATE TABLE `catalog_product_entity`;

TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
TRUNCATE TABLE `catalog_product_entity_text`;
TRUNCATE TABLE `catalog_product_entity_tier_price`;
TRUNCATE TABLE `catalog_product_entity_varchar`;
TRUNCATE TABLE `catalog_product_link`;
TRUNCATE TABLE `catalog_product_link_attribute`;
TRUNCATE TABLE `catalog_product_link_attribute_decimal`;
TRUNCATE TABLE `catalog_product_link_attribute_int`;
TRUNCATE TABLE `catalog_product_link_attribute_varchar`;
TRUNCATE TABLE `catalog_product_link_type`;
TRUNCATE TABLE `catalog_product_option`;
TRUNCATE TABLE `catalog_product_option_price`;
TRUNCATE TABLE `catalog_product_option_title`;
TRUNCATE TABLE `catalog_product_option_type_price`;
TRUNCATE TABLE `catalog_product_option_type_title`;
TRUNCATE TABLE `catalog_product_option_type_value`;
TRUNCATE TABLE `catalog_product_super_attribute`;
TRUNCATE TABLE `catalog_product_super_attribute_label`;
TRUNCATE TABLE `catalog_product_super_attribute_pricing`;
TRUNCATE TABLE `catalog_product_super_link`;
TRUNCATE TABLE `catalog_product_enabled_index`;
TRUNCATE TABLE `catalog_product_website`;
TRUNCATE TABLE `catalog_product_entity`;

TRUNCATE TABLE `cataloginventory_stock`;
TRUNCATE TABLE `cataloginventory_stock_item`;
TRUNCATE TABLE `cataloginventory_stock_status`;

insert  into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell');
insert  into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal');
insert  into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');

magento api

by admin | April 4, 2012 | In Magento tips No Comments

Hi all,

Over the last week i have been developing scripts that use the magento api, The api works fine but a work of advice, if you plan to use the api for large

quantities of data your in for a nasty surprise!! IT DAMN SLOW,

Fine for exporting and import small quantities for records such as customer orders etc.. but dont think of importing

30,000 product records or you will be old and gray before it finishes :)

Ok magento can grow massive, here is a script that will cleanup the files and database. as always please backup before running :)

<?php
$xml = simplexml_load_file(’./app/etc/local.xml’, NULL, LIBXML_NOCDATA);

$db['host'] = $xml->global->resources->default_setup->connection->host;
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
$db['user'] = $xml->global->resources->default_setup->connection->username;
$db['pass'] = $xml->global->resources->default_setup->connection->password;
$db['pref'] = $xml->global->resources->db->table_prefix;

if($_GET['clean'] == ‘log’) clean_log_tables();
if($_GET['clean'] == ‘var’) clean_var_directory();

function clean_log_tables() {
global $db;

$tables = array(
‘dataflow_batch_export’,
‘dataflow_batch_import’,
‘log_customer’,
‘log_quote’,
‘log_summary’,
‘log_summary_type’,
‘log_url’,
‘log_url_info’,
‘log_visitor’,
‘log_visitor_info’,
‘log_visitor_online’,
‘report_event’
);

mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
mysql_select_db($db['name']) or die(mysql_error());

foreach($tables as $v => $k) {
mysql_query(’TRUNCATE `’.$db['pref'].$k.’`') or die(mysql_error());
}
}

function clean_var_directory() {
$dirs = array(
‘downloader/pearlib/cache/*’,
‘downloader/pearlib/download/*’,
‘var/cache/’,
‘var/log/’,
‘var/report/’,
‘var/session/’,
‘var/tmp/’
);

foreach($dirs as $v => $k) {
exec(’rm -rf ‘.$k);
}
}
?>

http://www.magentocommerce.com/magento-connect/Magento+Core/extension/6887/mage_googleshopping

Well we all know that the upgrade of the magento system must be the worsed job to be handed,

Well there is a way and it seems to work!!

This is the most comprehensive description of the Magento 1.4 (1.4.1.1), 1.5 (1.5.1.0), 1.6 (1.6.0.0) upgrade process. It contains step-by-step instructions and troubleshooting information. Hope this information will help you to upgrade your Magento store up to the latest version with no troubles.

Prepare for Magento upgrade

Lets imaging that you have Magento 1.4.1.1. web store and you need to upgrade it to 1.5. or 1.6 version. First of all it is highly recommended to backup your live store files and database.

Next you need to get SSH access from your hosting provider and connect to your server via SSH protocol. After connection via SSH go to your store folder and execute these commands:

1 – Change permissions on lib/pear folder to writable (recursively):

chmod -R 777 lib/PEAR

2 – Execute this command to prepare Magento for upgrade:

./pear mage-setup

Most likely you will see this result after command execution:

Channel “connect.magentocommerce.com/core” is already initialized

Upgrade from Magento 1.4.1.x to Magento 1.4.2.0

This step is necessary even if you upgrade your Magento store to 1.5 or 1.6 versions.

3 – Execute Magento upgrade command:

./pear upgrade -f magento-core/Mage_All_Latest-stable

Output of the command will show you what core packages were upgraded:


upgrade ok: channel://connect.magentocommerce.com/core/Mage_Centinel-1.4.2.0
upgrade ok: channel://connect.magentocommerce.com/core/Interface_Frontend_Base_Default-1.4.2.0
upgrade ok: channel://connect.magentocommerce.com/core/Phoenix_Moneybookers-1.2.3
upgrade ok: channel://connect.magentocommerce.com/core/Find_Feed-1.0.7
upgrade ok: channel://connect.magentocommerce.com/core/Interface_Adminhtml_Default-1.4.2.0

4 – When this part of the upgrade will be complete, enter these commands:

chmod 550 ./mage
./mage mage-setup .

You will see this result after command execution:

Successfully added: http://connect20.magentocommerce.com/community

It means that Magento connect 2.0 channel was added to the channels list successfully.

5 – Next, enter this command:

./mage sync

The result will be:


Successfully added: community/Mage_Locale_en_US-1.4.2.0
Successfully added: community/Interface_Install_Default-1.4.2.0
Successfully added: community/Phoenix_Moneybookers-1.2.3
Successfully added: community/Mage_Downloader-1.5.0.0
Successfully added: community/Lib_Google_Checkout-1.4.2.0

Upgrade to Magento 1.4.2.0 is complete and now you can proceed with upgrade to Magento 1.5.1.0 or 1.6.0.0 version.

Upgrade from Magento 1.4.2.0 to Magento 1.5.10 or Magento 1.6.0.0

Now you can upgrade your store to version 1.5 or 1.6.

Before proceeding with this part of Magento upgrade, it is very important to see to what version Magento upgrade scripts will upgrade your store. Enter this command to check this:

./mage list-upgrades

If you will see this result:

Updates for community:
Mage_All_Latest: 1.4.2.1 => 1.6.0.0
Lib_Js_Mage: 1.4.2.0 => 1.6.0.0
Lib_Varien: 1.4.2.0 => 1.6.0.0
Lib_Phpseclib: 1.4.2.0 => 1.5.0.0

It means that your Magento will be upgraded to version 1.6.0.0. If it is not what you need you can change upgrade channel to “stable” and upgrade your Magento to version 1.5.1.0.

6 – Enter this command to change the upgrade channel to stable:

./mage config-set preferred_state stable

After this the “./mage list-upgrades” command will show you this result:

Updates for community:
Mage_All_Latest: 1.4.2.1 => 1.5.1.0.1
Lib_Js_Mage: 1.4.2.0 => 1.5.1.0
Lib_Varien: 1.4.2.0 => 1.5.1.0
Lib_Phpseclib: 1.4.2.0 => 1.5.0.0
Mage_Core_Adminhtml: 1.4.2.0 => 1.5.1.0
Mage_Core_Modules: 1.4.2.0 => 1.5.1.0

7 – After channel selection you can upgrade your Magento to 1.5.1.0 (or to Magento 1.6.0.0) using this command:

./mage upgrade-all –force

You will see upgraded packages on your screen:


Package upgraded: community/Mage_Locale_en_US 1.6.0.0
Package upgraded: community/Lib_Mage 1.6.0.0
Package upgraded: community/Lib_ZF 1.11.1.0
Package upgraded: community/Lib_Js_Prototype 1.7.0.0.1
Package upgraded: community/Lib_ZF_Locale 1.11.1.0

Now the upgrade is complete and you can execute database upgrade visiting your Magento store in your browser. If everything was upgraded correctly, you will see upgraded store in your browser.

You can check version of your store in the footer of Magento administration panel.

Need any help with Magento upgrade?

Turnkeye.com offers professional Magento support services (including Magento development and Magento upgrade service), feel free to contact our team.

Troubleshooting

1 – Magento upgrade script error:

upgrade-all: Please check for sufficient write file permissions.
Error: upgrade-all: Your Magento folder does not have sufficient write permissions, which downloader requires.

Execute this command to correct the error:

chmod -R 777 Upgrade

2 – Magento upgrade script error:

upgrade-all: Invalid stability in compareStabilities argument.

Execute these commands, it will fix the issue:

./mage channel-add connect20.magentocommerce.com/community
./mage channel-add connect20.magentocommerce.com/core
./mage sync

3 – Server error:

“Internal Server Error” instead of Magento storefront page or administration zone pages.

Most likely issue is connected with wrong permissions.

Fix this issue using these recursive commands:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

4 – Magento error: Different errors in Magento database.

Re-index your database in Magento administration panel and clear Magento cache.

5 – Magento error:

“Invalid mode for clean() method”.

Clear Zend cache (all files, including “Backend” folder) in [magento_folder]/app/code/core/Zend/Cache/

rm -rf app/code/core/Zend/Cache var/cache/* var/session/* (nice little command for you!!!)

6 – Magento error:

“Call to a member function toHtml() on a non-object in …/Layout.php”.

Open [magento_folder]/app/design/frontend/default/[your_theme]/layout/page.xml and replace this line of the code:

<block type=”core/profiler” output=”toHtml”/>

With:

<block type=”core/profiler” output=”toHtml” name=”core_profiler”/>

7 – Magento error:

“Maximum key size must be smaller 32″.

Clear Magento cache.

I have noticed that sometimes with magento the the featured products on the home page
disappear for not reason, After checking the cms page and the block code all looked fine.

The simple solution to this problem is to reindex the complete site.

system –> indexes and select all and re-index

Like magic the featured products re-appear