Edit app\design\frontend\theme\default\layout\customer.xml add action : [php]<action method="setMayBeInvisible"><value>0</value></action>[/php] to wrapper block, like this: [php] <reference name="content"> <block type="page/html_wrapper" name="my.account.wrapper" translate="label"> <label>My Account Wrapper</label> <action method="setElementClass"><value>my-account</value></action> <action method="setMayBeInvisible"><value>0</value></action> </block> </reference> [/php]

Read more

The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could block the execution.

To resolve this problem, set up new system variable in windows: Variable name: JAVA_OPTS. Variable value -Xms256m -Xmx512m Or just edit file : PhpStorm_Install\bin\PhpStorm.exe.vmoptions by increase or decrease -Xmx and -Xms paremeter

Read more

Delete magento attribute with options and values

[php] $attribute_code = ‘some_attribute_code’; $attribute = Mage::getModel(‘eav/config’)->getAttribute(‘customer_address’,$attribute_code); $options = $attribute->getSource()->getAllOptions(); foreach ($options as $option) { if ($option[‘label’] === ” && $option[‘value’]) { $newOptions[‘value’][$option[‘value’]][] = $option[‘label’]; $newOptions[‘delete’][$option[‘value’]] = $option[‘value’]; } } $installer->addAttributeOption($newOptions); $collection = Mage::getResourceModel(‘eav/entity_attribute_option_collection’) ->setAttributeFilter($attribute->getId()) ->setStoreFilter($attribute->getStoreId()) ->load(); foreach ($collection as $option) { $option->delete(); } $installer->removeAttribute(‘customer_address’, $attribute_code); [/php] Info about this type of attribute, may be […]

Read more

MySQL create, update and delete user

Create database

Create user

Update user


Read more

Saving product with data like this: $ids = array(‘1′,’1′,’2’); $_product->setWebsiteIds($ids); makes error : “SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry …”. To avoid this error, just use function array_unique, on $ids array. This solution, i think, could be implemented as default in new version of Magento.

Read more

Remove get param from url

[php] protected function removeQsVar($url, $varName) { $parts = parse_url($url); $queryParams = array(); parse_str(html_entity_decode($parts[‘query’]), $queryParams); unset($queryParams[$varName]); $queryString = http_build_query($queryParams); if(strlen($queryString)>0){ $queryString = ‘?’ . $queryString; } $url = $parts[‘scheme’] . ‘://’ . $parts[‘host’] . $parts[‘path’] . $queryString; return $url; } [/php]

Read more

[php] $corehelper = Mage::helper(‘core’); $cheapestrate = 0; if($_product->isSaleable()) { $_product = Mage::getModel(‘catalog/product’)->load($_product->getId()); $quote = Mage::getModel(‘sales/quote’); $quote->getShippingAddress()->setCountryId(‘PL’); $addToCartInfo = (array) $_product->getAddToCartInfo(); $request = new Varien_Object($addToCartInfo); if ($_product->getStockItem()) { $minimumQty = $_product->getStockItem()->getMinSaleQty(); if($minimumQty > 0 && $request->getQty() < $minimumQty){ $request->setQty($minimumQty); } } $_product->getStockItem()->setUseConfigManageStock(false); $_product->getStockItem()->setManageStock(false); $quote->addProduct($_product, $request); $quote->getShippingAddress()->collectTotals(); $quote->getShippingAddress()->setCollectShippingRates(true); $quote->getShippingAddress()->collectShippingRates(); $rates = $quote->getShippingAddress()->getShippingRatesCollection(); $_rates = array(); if($rates->count()){ foreach […]

Read more

Upgrade Magento from 1.3, 1.4 .. to latest via ssh

1. [php]chmod -R 777 lib/PEAR[/php] 2. [php]./pear mage-setup[/php] 3. [php]./pear upgrade -f magento-core/Mage_All_Latest-stable[/php] 4. [php]chmod 550 ./mage[/php] 5. [php]./mage mage-setup .[/php] 6. If You have got an error: “Channel ‘community’ already exist!” try this: [php]php -f downloader/mage.php channel-delete community [/php] 7. [php]./mage sync[/php] 8. [php]./mage list-upgrades[/php] 9. [php]./mage config-set preferred_state stable[/php] 10. [php]./mage upgrade-all –force[/php] […]

Read more

Arrow keys in terminal: [[A^[[B^[[D^[[C

If you try use arrow keys in terminal and get sth like: [[A^[[B^[[D^[[C just do: cd /etc sudo nano passwd and replace /bin/sh to /bin/bash near your username

Read more

Simple Configurable Products index price error

Simple Configurable Products module from Organic internet is one of better solution for display configurable products. However, Magento not supported it completely. To make it work, you simple should add in file:


this code:

and in file:



Read more