Rss Feed Tweeter button Facebook button Technorati button Reddit button Myspace button Delicious button Digg button

Magento Price and Stock Availability No Longer Showing

Encountered an error in Magento when price and stock availability no longer displayed in product view using Hellowired template.

After upgrading to 1.5, prices would show in the catalogue and grid views but on the product view the price and stock availability was not showing.

Found a fix for simple products after files have changed between Magento 1.4 and 1.5, Template/catalog/product/view/type/ simple.phtl is now deprecated and default.phtml used instead. Older templates need to be changed:

  • Located in /app/design/frontend/default/YOURTEMPLATE/layout
  • You need to change all instances in the file catalog.XML that point to simple.phtml and make it read default.phtml

I only have one instance around line 285.

Change template=”catalog/product/view/type/simple.phtml”>

to template=”catalog/product/view/type/default.phtml”>

While this needs to be done it made no difference for me and the price was still not showing. Ah, the joys of Magento!

Hopefully the above will fix your issue. If it didn’t carry on reading.

After a lot of digging around comparing two different templates I found a fix.

In Hellowired there was a slight difference in a file so I changed \hellowired\template\catalog\product\view.phtml

  • around line 61 <?php echo $this->getChildHtml(‘product_type_data’) ?>
  • to:                     <?php echo $this->getChildHtml(‘product_type_data_side’) ?>

 

I have yet to figure out why but it does work.

Removing Coupon Code from Magento Checkout

If you don’t use coupon codes then to remove the field at checkout edit

/app/design/frontend/base/default/template/checkout/cart/coupon.phtml

Delete the whole <form> section around lines 27-44.

The primary reason to remove the code is to prevent customers from leaving checkout when they wonder why they don’t have a code.

Am I missing out?

Should I Google for a code?

Is someone else buying things cheaper than me?

If customers follow this train of thought they will leave so remove the code and let them proceed.

 

 

 

 

Fix Magento Error Cannot add the item to shopping cart

Currently trying out multiple websites function in Magento, which is unfortunately not a straightforward process.

Kept encountering the error Cannot add the item to shopping cart with the second website. It works in the catalogue grid but in the product view it will not add the item to the cart.

After a lot of digging around the problem seems to be that the second website cannot access the cache.

Fix:

  • Create a new directory called tmp in the home directory of the second website.
  • Edit /lib/Zend/Cache/Backend/File.php
  • change ‘cache_dir’ => null, to ‘cache_dir’ => “tmp/”,
  • ensure there it a directory tmp in your original root installation also.

Update

There is a better way to do it and one which does not involve editing core files. It is also simpler:

  • System->Configuration->Web->Session Cookie management
  • change value from 3600 to 86400

Fix for Magento Error in IE9 Additional Information tabs not working.

I noticed the additional information tags in Magento stopped working – the lightbox opened over the page when clicked upon.

I removed Magento Easy Lightbox Community Module but now the information tab does nothing.

The pages work fine in Firefox but IE9 doesn’t appear to like the part of the javascript  and the developer console gives an error.

I was not able to fix it so as a work around used:

<meta http-equiv=”X-UA-Compatible” content=”IE=7″/>

in the head section of the page. From memory this is located in \app\design\frontend\base\default\template\page\html\head.phtml

Back to working properly again.

How to Restrict Quantity of Items in Magento

I have been looking at how to stop checkout of maximum quantities in Magento for one product category e.g. one per transaction or one per customer only.

The short answer: it’s not possible (unless you want to pay for a commercial extension).

The workaround

Scenario: I am starting a penny sale – simply pay for postage and packaging and buy something for 1p, or add a penny item to your order.

Orders from the penny sale category will be restricted to one per transaction. As this is not possible I have decided on a surcharge instead.

This has the benefit of allowing customers to decide if they wish to purchase more than one and allows the retailer to use existing Magento tools.

We are going to use Shopping Cart Price Rules (under the promotions tab from the dashboard). If the customer purchases more than one item from the category then £1 will be added for the second and each additional item in the shoppping cart.

By default a surcharge (or negative discount) is not allowed in Magento so we need to change a few lines of code to enable it:

1. Go to app/code/core/Mage/Rule/Model/Rule.php

Find the line:

//check if discount amount > 0
if ((int)$this->getDiscountAmount() < 0) {
Mage::throwException(Mage::helper(‘rule’)->__(‘Invalid discount amount.’));
}

Just add some bars // to comment the code:

//check if discount amount > 0
//if ((int)$this->getDiscountAmount() < 0) {
//Mage::throwException(Mage::helper(‘rule’)->__(‘Invalid discount amount.’));
//}

2. Now go to: app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php

Look for:

$fieldset->addField(‘discount_amount’, ‘text’, array(
‘name’ => ‘discount_amount’,
‘required’ => true,
‘class’ => ‘validate-not-negative-number’,
‘label’ => Mage::helper(’salesrule’)->__(‘Discount amount’),

And again comment like this:

$fieldset->addField(‘discount_amount’, ‘text’, array(
‘name’ => ‘discount_amount’,
‘required’ => true,
// ‘class’ => ‘validate-not-negative-number’,
‘label’ => Mage::helper(’salesrule’)->__(‘Discount amount’),

3. Translate the discount word.

Go to app/locale/en_US

Find a file called Mage_Sales.csv. Inside look for the word discount you will find something like:

“Discount (%s)”,”Discount (%s)”
Change the text to what ever you like, e.g.:
“Discount (%s)”,”Extra Fee (%s)”

The above section comes from: http://php.quicoto.com/extra-fee-shopping-cart-price-rules-magento/

 

Next we need to create the shopping cart rule by setting the conditions:

My sale catgegory is 55 so I want to activate the rule when more than one item from category 55 is added to the cart.

 

Then we need to create the actions rule to tell Magento what to do when the above conditions are met:

You will notice I have added an extra condition in the actions section. This is to ensure only items in category 55 attract the £1 surcharge – without it £1 would be added for every item in the shopping cart.

It is not quite how I wanted it to work as it add £1 for every item in the basket if rather than only for the second one, third one etc, but it will have to do.

Whilest it is unfortunate that the rules in Magento are not more flexible or easier to customise, after hours or research this is the simplest and quickest workaround I have found.

Change Magento Category Image Size

For some reason category images were being expanded to fit the column size.

Instead of a 100px picture customers would see it expanded to 520px.

To fix it, edit the style sheet:

/skin/frontend/default/YOURTEMPLATENAME/css/styles.css

Look for the value category-image.

I made the following changes to mine:

  • change the alignment to left at the end of the first line – previously it was center
  • delete the end of the second line – previously it was width 100%

.category-image { width:100%; overflow:hidden; margin:0 0 10px; text-align:left; }
.category-image img

Magento Read timed out after 10 seconds

Getting this error for google base? It is intermittent and frustrating.

Edit the following file on your server:  /lib/Zend/Http/Client.php

Locate the following line:
‘timeout’ => 10

Change the value 10 to 30.

Magento Remove Back to School and The Dog

Those pointless and annoying callouts in Magento! Back to School and the Dog call us on (555) 555-0123. Every Magento user is familiar with these side boxes.

I found the simplest way to remove them is to rename the call out files so their functions no longer exist.

/app/design/frontend/base/default/template/callouts

rename the two files by putting something in front of them e.g.:

STOPleft_col.phtml

STOPright_col.phtml

Pointless call-outs gone!