home | contact us
» Posts tagged "custom"

Items Tagged: custom


If you have a load of terminals open you might find it handy to be able to rename the window title on the fly.

You can do this easily by copying this code into your ~/.bashrc file (or even pasting it into your terminal if you like)

function nameTerminal() {
    [ "${TERM:0:5}" = "xterm" ]   && local ansiNrTab=0
    [ "$TERM"       = "rxvt" ]    && local ansiNrTab=61
    [ "$TERM"       = "konsole" ] && local ansiNrTab=30 ansiNrWindow=0
        # Change tab title
    [ $ansiNrTab ] && echo -n $'\e'"]$ansiNrTab;$1"$'\a'
        # If terminal support separate window title, change window title as well
    [ $ansiNrWindow -a "$2" ] && echo -n $'\e'"]$ansiNrWindow;$2"$'\a'
}

If you have pasted this into your ~/.bashrc file you need to launch a new terminal or run:

source ~/.bashrc

From this point the function is now ready to use and you can run:

nameTerminal "My Custom Terminal Window Title"

Now you can easily choose the terminal you want based upon the window title.

Of course this then opens the door to automatically changing the window title based on all kinds of events that you might like, isn’t bash scripting fun!


 

Thinking of being able to set different Magento Categories to display its sub-categories which can be controllable in the Magento admin i.e.

from        to this;    

You might be interested in using or viewing the zipped file here;subcat


 

If you have a controller action that is designed to be accessed by AJAX requests or perhaps as part of a custom API system then you might like this snippet.

If you are working with the above scenario you likely would like to return pure JSON without any HTML etc. Also serving up the correct content type headers is going to be helpful, its not HTML, its JSON.

    public function searchAction(){
        $query = $this->getRequest()->getParam('query');
        $json = Mage::getModel('mymodule/mymodel')->getSearchJson($query);
        $this->getResponse()->setHeader('Content-type', 'application/json');
        $this->getResponse()->setBody($json);
    }

 

If you want to serve up text files for download (perhaps product feeds etc) then you might like this little snippet.

Not only will it force the file to be downloaded but it allows you to specify a custom filename that it should be saved as.

if(isset($_GET['download_file'])){
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=Export.txt");
    readfile('Export.txt');
    die;
}

 

If you have created a new product type and need to enable it to be included with configurable products you need to let Magento know that it should allow your product type to work with configurable products. To do this open your config xml and add the following xml.

<config>
    <global>
        <catalog>
            <product>
                <type>
                    <configurable translate="label" module="catalog">
                        <allow_product_types>
                            <custom_type_name/>
                        </allow_product_types>
                    </configurable>
                </type>
            </product>
        </catalog>
    </global>
</config>

This tells Magento to include your product type for use with configurable products.


 

If you use Linux on a regular basis, you’ll probably know just how useful a symlink is.

This makes things extremely annoying when a program refuses to work with them – treats them as a file or just refuses to work.

Enter: mount –bind

mount –bind is a special type of mount that will mount one directory as a child of another. Quite often this is used for simplifying partitioning or if a cpanel server runs out of disk space.

The general usage at the commandline is :-
mount --bind olddir newdir

and in the fstab :-
olddir newdir none defaults,bind 0 0

For instance, setting up a system where /home, /var and /opt share a partition and everything else is on another can be done like this in your fstab :-

#root fs
UUID=ebb8043d-6f1e-4a65-8d73-2c05f7ec213a / xfs defaults 0 1
#two tibibyte partition
UUID=6210e43f-83a3-4001-83c7-40e3b1fb9c8e /twotib xfs defaults 0 2
# Following binds
/twotib/home /home none defaults,bind 0 0
/twotib/opt /opt none defaults,bind 0 0
/twotib/var /var none defaults,bind 0 0


 

If you want to include a custom stylesheet for a particular category you can do this very cleanly by specifying custom layout xml in the category admin.

Simply find the category you want to apply this to and then hit the [display settings] tab

Then in the custom layout update box, paste something like this:

<reference name="head">
<action method="addCss"><stylesheet>css/extra_styles.css</stylesheet></action>
</reference>

clear your cache and this stylesheet should be included in the head section for this category.

You could of course do this in the layout XML files, however if you need somethign that the admin of the site can easily apply to any other new categories that needs the same treatment then this is a great solution.


 

Magento Upgrade with Custom Modules Rewrite

The aim of this project was to upgrade a store from 1.3 to 1.5, without losing the functionality of the site. The old version had had its core files modified, requiring a forensic examination of them in order to find and extract what had been changed.

Love My Frames

Love My Frames is run by highly trained technicians with over 40 years’ optical experience, offering the kind of personal service you would normally expect from a high street opticians. Offering the best for considerably less, professional service and door-to-door delivery, they give their customers the ultimate shopping experience online plus the opportunity to purchase the very latest designs at a great price.

The project asked for a clean install and then rewrite of the existing store. The biggest part of the project was taking the existing layered navigation and rewriting it to work on all pages with a custom design.


 

Single Page Magento Store With Affiliate Program and PayPal Link

The aim of this project was to condense a Magento store into a single page, offering both product information and payment options. The system is to integrate with PayPal and a custom affiliate system.

Golfer Within

Run by Roseanna Leaton, one of the leading practitioners of self-improvement. A keen 9-handicap golfer, Roseanna combined her knowledge of the game and the mind mechanism to create the acclaimed Golfer Within recordings which enable any player to lower their handicap

The Golfer Within PAge

This project asked for a one click option method linking Magento to PayPal and then back again, without having to use the normal checkout pages. This required creating custom magento controllers so the method wouldn’t interfere with the other stores running off the same back end.


 

Grass Seed Store – Migration from OSCommerce with Custom Functionality

The Grass Seeds Store wants to migrate away from OSCommerce to Magento in order to improve stock management. They also need to maintain DEFRA compliance and have custom reports generated to do so. The custom reporting was based on the sales of seeds.

The Grass Seed Store

The Grass Seed Store specialises in the sale of a many different types of grass seed, fertiliser and live stock pasture.

Screen Short of Grass Seed Store Magento Product

This project is a great example of customising Magento to be compliant with an industry governing body and shows that Magento can be used in almost any for the sale of any type of product. The project is currently a work in progress and the Magento implementation is currently only a wire frame demonstrating the functionality that is ultimately required.


 
rss icon