Magento Themes and Magento Extensions

Magento add Bestseller products by date range

Share
Posted on December 2nd, 2012 | Posted by admin

Magento add Bestseller products by date range

Here is how to get a collection of products best sold in a given date range

01.<ul>
02.<?php
03.$from = date("Y-m-d H:i:s", (time()-2592000));
04.$to = date("Y-m-d H:i:s", time());
05.
06.$_productCollection= Mage::getResourceModel('reports/product_collection')
07.->addAttributeToSelect('*')
08.->addOrderedQty($from, $to, true)
09.->addAttributeToFilter('status', 1)
10.->setOrder('ordered_qty', 'desc')
11.->getSelect()->limit(10)->query();
12.

Get Cart Quantity in Magento

Share
Posted on December 1st, 2012 | Posted by admin

Get Cart Quantity in Magento

You can get the number of items currently in the cart using the following code.

1
2
$cart = Mage::getModel('checkout/cart')->getQuote()->getData();
echo (int)$cart['items_qty'];

However,if the cart is empty, writing only the above code will show error (Because $cart['items_qty'] is only set when there are items on the cart). For that you need to check if the value is set or not. Hence the total code will be like –

Programmatically Create Magento Product Packages

Share
Posted on November 30th, 2012 | Posted by admin

On a recent project I had to write a piece of code which I thought I’d share with the Magento community in case it comes in useful for anyone. I have put all the code into one ‘add to cart’ controller below for the sake of simplicity, but you could break it up into separate methods to clean up the code a bit.

In a nutshell, all products on the site have a normal price and some have a package price. If they have a package price they are capable of being purchased with other products as part of a package deal, but only two at a time. Therefore these products had to be purchased as one product using the special prices as we can’t have customers adjusting the quantities of items added to the cart. Here’s the code in myPackageController.php broken up:

REFLECTING ON MAGENTO

Share
Posted on November 29th, 2012 | Posted by admin

The last couple of weeks I have been building an e-commerce website using open source software Magento. The most important factor about Magento is the ability to change absolutely anything in the code to suit your own requirements meaning anything is possible.

The one problem with this is the well-known steep learning curve that comes along with the software where even the simplest of tasks become hours worth of online investigation. The lack of one-to-one support results in the scouring of forums, chat rooms and blog posts until you find your answer, which when people have their own problems to deal with, can mean that help is not top of anyone’s priority.

Ten great ecommerce tips for Magento

Share
Posted on November 28th, 2012 | Posted by admin

Ten great ecommerce tips for Magento
Practical eCommerce – the leader in Ecommerce news – asks industry insiders each month to share a great, innovative idea that could help an ecommerce company succeed. Here’s what ten of them had to say for the July 2009 installment.
1. Focus on Upsell Products, Roy Andre Tollefsen, Lead Designer
2. Automation is Not a Subsitute for Outstanding Support
3. Tap Location Online to Drive Offline Sales
4. A/B Split Testing
5. Find Related Forums and Blogs
6. Don’t Be Afraid to Experiment
7. Maximize Your Profit on Every Item Sold
8. More Trust Equals More Revenue
9. Add a Video Play Button
10. See Things From a Customer’s Viewpoint