Magento Themes and Magento Extensions

How to add “View All” button in Magento’s pagination

Share
Posted on June 20th, 2011 | Posted by admin

Hi, I had a bit of unusual request from a client and I had to create “View All” button and put it into Magento’s pagination on category listings, so I decided to share the trick.

So, since this is a very specific task, I believe that no further explanation is needed. And now, lets begin.

First of all, we need to trace the “pager.phtml” file in our working template directory. When you do, all that needs to be added is the following code somewhere to fit your needs:

1
2
3
4
<a href="<?php echo $this->getLimitUrl('all')?>" title="< ?php echo $this->__('View All Products') ?>">
< ?php echo $this->__('View All') ?>
</a>

Now we’ve added our link to pagination. And only thing important here is the following segment of code:

Magento: Display Static Block via Custom Layout Update

Share
Posted on June 20th, 2011 | Posted by admin

We were needing to display a static block in the left column (of the 2-columns-left template). We only needed to display it for a few specific products though. There are a couple ways you can do it via Custom Layout Updates. In our case, the products were all in a specific category, and we wanted the static block to show up on the list view AND the product view. So, we put this code in on the product level and the category level:

<reference name="left">
    <block type="cms/block" name="static_block_identifier" before="-">
        <action method="setBlockId"><block_id>static_block_identifier</block_id></action>
    </block>
</reference>

Magento: Issue with getAttributeText()

Share
Posted on June 20th, 2011 | Posted by admin

I haven’t been able to take the time to test this more in-depth, and on different versions yet – fyi. I have only tested this on 1.4.1.1.

If you need to output the value(s) of an dropdown or multiselect attribute for a product, you use getAttributeText(‘attribute_code’). This works perfectly fine on these attributes as long as only 1 option is selected. In this case, it will return a string. However, if you have a multiselect attribute with more than 1 optino selected, it then returns an array.

While this seems like it would make sense, it doesn’t bid well for multiselect attributes, as you have to account in your code to check if it is returning a string or an array, and display it accordingly. Instead of a nice clean attribute call like:

echo $_product->getAttributeText('attribute_code') ;

You have to do something like this instead for all multiselect attributes:

Usage of database stored procedures

Share
Posted on June 19th, 2011 | Posted by admin

Hello guys. Today I’ll try to explain 2 things. First WHY to use stored procedures. And second, HOWto use them. First of all, a small notice. I’ll explain the subject on PostgreSQL example, because of the fact that I used that language syntax most recently.

So let’s begin with the question “Why?“.

Depending on the client’s needs and his limitations sometimes you need to use them to decrease the number of queries to a minimum. An example of that is if you have a situation of network overhead, stored procedures come in handy to minimize the network traffic. Or on the other hand, sometimes you just need to move some of the database logic to a DB side. A good example of that would be if you have a “Cron job” that will clean (truncate) some of the database’s tables.

My example would be based on that specific case, because it will cover some of the most used features and capabilities of PL/pgSQL (SQL procedural language).

Magento performance, research and improvement

Share
Posted on June 19th, 2011 | Posted by admin

I made a small research regarding  Magento performance. Perhaps, you already know it, but I would like to share this with other people who probably haven’t heard about this problem.

Do you know how many HTTP requests does standard Magento with default template make?  I have tested Magento and I’ve got very interesting info, 111 HTTP requests! I think it’s too much especially if you add a lot of new pictures, which you will use in your adjusted template. Then  the number of http requests can increase to 150! Every element requires an extra http request. Perhaps, not when the cache is full, but definitely when the cache is empty.

I used a free tool called  “Web Page Analyzer” .

Page 10 of 19« First...«89101112»...Last »