Home Archive

Articles tagged with: Magento Programming

26 Jul 26 Jul 2009 0Comment

Just some code for custom category menu navigation. I’m a bit short on time so, no fancy walk trough. All you need to make this show on your page is to call it inside layout file like
<block type=”core/template” template=”surgeworks/customcatnav.php” />
Filename: customcatnav.php.

<?php
//Get store id
$storeId    = Mage::app()->getStore()->getId();

//Get category model
$_category = Mage::getModel(’catalog/category’)->setStoreId($storeId);

$_categoryCollection = $_category->getCollection();
$_categoryCollectionIds = $_categoryCollection->getAllIds();

//Remove root category from array
unset($_categoryCollectionIds[0], $_categoryCollectionIds[1]);

?>

<div class=”content”>
<?php

$o = null;

$o .= ‘<dl>’;
foreach ($_categoryCollectionIds as $catId)
{
$_category = $_category->load($catId);

if($_category->getLevel() == 2)
{

$catChildren = $_category->getChildren();
if(!empty($catChildren))
{
$o .= ‘<dt>’.$_category->getName().’</dt>’;

$categoryChildren = explode(”,”, $catChildren);

foreach ($categoryChildren as $categoryChildId)
{
/* @var $_childCategory Mage_Catalog_Model_Category */
$_childCategory = $_category = Mage::getModel(’catalog/category’)->setStoreId($storeId)->load($categoryChildId);

$o .= ‘<dd>’;
$o …

Read More

 
23 Jul 23 Jul 2009 2Comment

Recently, I just finished coding out a website for a client in Magento. You can view the site at www.3graces.com, it was a full switch from some old legacy asp shopping cart to Magento. Im really happy with the way things turned out and the client is too, Magento just has so many wonderful features built-in.
One feature that I found wasn’t built in was a way to display each sub-category with an image, and its name on a landing page. Magento has a nice feature which allows you to assign …

Read More

 
23 Jul 23 Jul 2009 3Comment

Here are 3 quick solutions to try if you do not see your Magento store categories after a fresh install of Magento or an upgrade to the latest version. I wanted to post this because I just recently helped install Magento for someone and experienced this. The installation version was the latest Magento version, 1.2.1.2 and product categories did not show up on the frontend after they were added in the administration interface.
The top 3 solutions to this in my experience are:

The categories not added as sub-categories of the Default, …

Read More

 
23 Jul 23 Jul 2009 0Comment

This is quite a common want, so I thought I would put together a quick tutorial with some ideas and pointers. My main goal will be to give you a starting point for building a static block and PHTML file that can be applied to top level categories to dynamically create a block with of all the subcategories.
The first thing to do is create a new static block (CMS → Static Blocks), lets call it ‘Dynamic Landing Pages’. Within the content paste this:
{{block type=”catalog/navigation” name=”catalog.category” template=”catalog/category/list.phtml”}}
If you’ve not seen …

Read More

 
20 Jul 20 Jul 2009 6Comment

Magento Vertical Menu using Peter Hamilton’s code
In one of our premium Magento themes we implemented a vertical category menu with the code adapted from this thread. It’s quite easy to implement and to make it even easier for others, we decided to write a step by step tutorial.

Add a new block type in “catalog.xml” file
Create a new phtml file and name it “leftnav.phtml”, place it inside catalog/navigation
Edit CSS

Add a new block type in “catalog.xml” file
Here we presume you want to have the vertical category menu shows up on every page, …

Read More

 
18 Jul 18 Jul 2009 0Comment

I have a few custom blocks I’ve written / copied and tweaked from various posts on Magento’s forums. I noticed they are pretty universal in how they grab, filter and return a product collection to be used in various template files (.phtml files). The blocks below should all work from List.phtml (app\design\frontend\default\default\template\catalog\product\list.phtml).
These are Block files and are most appropriately used within the Catalog/Product area. (See my post on creating a custom module – these files won’t be overwriting any other class but can …

Read More

 
18 Jul 18 Jul 2009 3Comment

Many developers are familiar with the MVC (Model View Controller) design pattern that is seemingly ubiquitous throughout web frameworks. Looking through the code in Magento, however, we see many other components besides the M’s the V’s and the C’s.
Each module  (a “module” meaning the separate directories within the “app/code/core/Mage” directory that comprise of Magento’s different functional areas) contains the usual Controller and Model. You’ll see that within each module, there are no Views (more on this later). You’ll also see extra tidbits, such …

Read More

 
18 Jul 18 Jul 2009 0Comment

Magento is the open-source Ecommerce platform promising a magnificent revolution in the industry. Magento was designed with the concept that each Ecommerce implementation has to be unique since no two businesses are alike. Magento’s modular architecture puts the control back in the hands of the online merchant and places no constraints on business processes and flow.
We provide Magento customization and creative services to shop owners worldwide. Services include Magento theme design, Magento customization, Magento theme development based on existing designs, Magento Website development, Magento installation, Integration of new payment methods, …

Read More

 
18 Jul 18 Jul 2009 0Comment

I’ve recently accepted a side project for a friend building an ecommerce solution that required some customizations.  I’ve read about Magento, attending a presentation about it at ZendCon 2008 by a couple guys from Varien, and viewed a few of the sample sites.  With my years of experience with oscommerce ecommerce, I was eager to dive right in and customize one of these!  Unfortunately, it turns out Magento sucks to work on.  Yes, I said Magento sucks.
Features
Magento has nearly all the ecommerce features you could imagine.  It has pretty much …

Read More

 
17 Jul 17 Jul 2009 0Comment

Magento Commerce is certainly an “SEO-friendly” shopping cart – but just like much of its brethren, there is still room for improvement. Granted, it has come along to fix some of the issues we pointed out in our first Magento review, and a few in the community have put together some extensions to further that along.  Yoast has even gone so far as to creating a beginner’s SEO guide for Magento which does a great job of covering some of the basic setup points for those setting up a Magento …

Read More