Search This Blog

Thursday, 8 September 2011

Using Collections in Magento

A collection is a Model type containing other Models, it is basically used in Magento to handle product lists (ie. from a category or a bundle option), but not only.
TO DO: Explain how Magento Implements a collection - Use this to explain how Magento implements a collection by looking at code in a model, so that people can learn to write their own collections
This is a simple example of loading some product collection from a category and ordering them on their product name using Magento’s API.

http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/using_collections_in_magento

Wednesday, 31 August 2011

addAttributeToFilter Conditionals In Magento

addAttributeToFilter is a function that can be called on a product collection in Magento. In short, it adds a condition to the WHERE part of the MySQL query used to extract a product collection from the database.

http://fishpig.co.uk/magento-tutorials/addattributetofilter-conditionals-in-magento

Monday, 8 August 2011

Creating a Store Locator with PHP, MySQL & Google Maps

This is intended for developers who are familiar with PHP/MySQL, and want to learn how to use Google Maps with a MySQL database to create a store locator-type app. After completing this tutorial, you will have a database of locations and a webpage that lets a user enter their address and see markers on a map for the locations nearest to them, within a chosen distance restriction. more



Monday, 1 August 2011

Method Varien_Object::__tostring() cannot take arguments

When I try open the magento fodler to install it, I get the following error:

Fatal error: Method Varien_Object::__tostring() cannot take arguments in C:\xampp\htdocs\magento\lib\Varien\Object.php on line 488


File: /lib/Varien/Object.php (Line 484)

Change from

public function ___toString(array $arrAttributes = array(), $valueSeparator=',')

To this

public function __invoke(array $arrAttributes = array(), $valueSeparator=',')

File /app/code/core/Mage/Core/Controller/Request/Http.php (Line 274)

Change from

$host = split(':', $_SERVER['HTTP_HOST']);

To this

$host = explode(':', $_SERVER['HTTP_HOST']);

Thursday, 7 July 2011

Quantity Box in the Category Products Listing Page

Your Magento product ordering might seem a long process to some business owners, so we thought of making it simple, so that users can directly enter the quantity in the products listing area and click on ADD TO CART and checkout.

So, here is how you can do that.

Goto /app/design/frontend/default/your-theme/template/catalog/product/list.phtml

Open the file on a code editor and find this line,

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

Just replace it with,

<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
 <?php if(!$_product->isGrouped()): ?>
 <label for="qty"><?php echo $this->__('Qty') ?>:</label>
 <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
 <?php endif; ?>
 <button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
 </form>

You are done! If you want to style the quantity box, you can add class css to it.

Wednesday, 29 June 2011

Guest chat feature in Google Talk

Yesterday I found a new feature introduced by Google to enable Guests on your website or blog to chat with you.

New! Chatback

Let visitors to your site chat with you



I think its really cool. The guests won't know your Googletalk or your Gmail ID but they can still ping you if you are online.

You can also customize the title and toggle the display of online status message. When they ping you you will get a guest chat window in Gtalk. If you are using Pidgin, you will get a link for a chat window.