1. Home
  2. Prices
  3. Guided Tour
  4. New Shop
  5. Shop Review
  6. Ecommerce Marketing
  7. Ecommerce TV
  8. Magento Developers
  9. Portfolio
  10. Blog
  11. Contact

Magento Tips

Archive for the ‘Magento Tips’ Category

Sagepay Server Change, Protx and Magento

Posted on: 2nd Sep 2010 By: Luci Smethurst No Comments

Occasionally, the folks at Varien are just a step behind the folks at places like Sagepay. When this happens, clients tend to get a little stressed – especially when they receive emails saying that servers are being changed and so their payment method needs to be updated. But don’t worry – the folks at the ecommerce web design are here to help!

This latest misstep is between Sagepay and Magento. The Sagepay payment servers are going to be moving at the end of September, so they’ve been very nicely letting their customers know that their modules need updating – and with plenty of notice, which I (for one) certainly appreciated!

At the time of writing, I couldn’t find an update for the Protx module for Sagepay built in to Magento 1.4.1. So, we updated it ourselves and decided to post it here on our Magento blog to help anybody else in a panic.

Find the file located at: App / Code / Core / Mage / Protx / Model / Standard.php

Then create a local copy (App / Code / Local / Mage / Protx / Model / Standard.php) and open it up in your favourite text editor (mine’s Dreamweaver CS5).

At about line 78 there’s a function called “getProtxUrl”. Presuming your site set to either Live or Test, change the respective URLs to

https://live.sagepay.com/gateway/service/vspform-register.vsp

and

https://test.sagepay.com/gateway/service/vspform-register.vsp

A quick note – this is for clients using the Sagepay Form method and Magento. If you’re signed up for the Sagepay Server method and are using the Protx Magento module, the links will be

https://live.sagepay.com/gateway/service/vspserver-register.vsp

and

https://test.sagepay.com/gateway/service/vspserver-register.vsp

Also – check out Rob and I in the new video from Creare!

Categories: Magento Tips Tags: ,

Magento Meta Tags and Titles

Posted on: 23rd Aug 2010 By: Robert Kent No Comments

This is an update to all the magento meta data posts we’ve had so far. This will allow you to configure meta data and custom page titles.

What the following script will do is:

  • Check for the default meta info and remove tags
  • Ability to add meta info to pages individually
  • Keep old meta data if its not in the list of pages and has not got the default meta info

This technique is especially useful as it allows you to add meta information to pages where you may not be able to do so in the code or in the CMS. Pages such as the checkout and the contact pages. I have included these two into the example below.

What you need to do is edit your head.phtml file and paste the following above everything.

<?php
$page = $_SERVER['REQUEST_URI'];

//add your pages into this array
$pagearray = array("shop/contacts","shop/checkout/cart");

foreach($pagearray as $pages){
$test = strpos($page,$pages);
if($test !== false){
$pageres = $pages;
}
}
if($pageres){
switch($pageres):
// case 1 here
case "shop/contacts":
$title = "Contact";
$keywords = "contact, me, at, my, store";
$description = "Contact me at my store.";
break;
// case 2 here
case "shop/checkout/cart":
$title = "Checkout - My Test Store";
$keywords = "Checkout, Buy, My, Things";
$description = "Buy my things at my test store.";
break;

endswitch;
} else {
// if not in the array do the normal
$keywords = $this->getKeywords();
$description = $this->getDescription();
$title = $this->getTitle();
}

//check for default - if default remove the meta info

if($keywords == "default"){
$keyw = false;
} else {
$keyw = true;
}
if($description == "default"){
$desc = false;
} else {
$desc = true;
}

?>

The above is quite simple and will let you add pages to an array and then add them to the case statement in order to specify the meta information.

Next you will simply need to add some conditional braces around your usual meta tags and change what is echo’d.

<title><?php echo $title ?></title>
<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<?php if($desc){ ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } ?>
<?php if($keyw){ ?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<?php } ?>

Again it’s these simply little tricks that can lead to better Search Engine rankings – the less duplicate data – the better!

Thanks for visiting the magento blog at ecommerce website design home of the magento fox!

Categories: Magento Tips Tags: , , ,

Optimised Magento Store Information

Posted on: 16th Aug 2010 By: Adam Moss No Comments

If you have a Magento installation with multiple websites or store views set up on it, you want to cut down on duplications of content wherever possible. It’s good for Magento SEO, and it’s good for occasions when you have to change something such as a store name. Rather than change it wherever it’s mentioned, just change it in one place in the backend and it will update throughout the site. It’s exactly the same as using PHP includes, in fact they are PHP includes. This type of include makes it easy to customise each store on the installation with it’s own logo, own name & URL etc, without having to code it more than once. It’s also useful for performing your own PHP scripts based on which store ID is loaded.

Anyway, here’s a good list to start you off. If you have any more, please let me know them:

Store data
:

<?php echo Mage::app()->getStore(); ?>

Store Id
:

<?php echo Mage::app()->getStore()->getStoreId(); ?>

Store code:

<?php echo Mage::app()->getStore()->getCode(); ?>

Website Id
:

<?php echo Mage::app()->getStore()->getWebsiteId(); ?>

Store Name
:

<?php echo Mage::app()->getStore()->getName(); ?>

Is Active:

<?php echo Mage::app()->getStore()->getIsActive(); ?>

Store Home Url:

<?php echo Mage::app()->getStore()->getHomeUrl(); ?>

Store Logo:

<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>

I’ve added the PHP tags for you since I’m such a nice guy… err anyway, thanks for reading the Magento Blog at Ecommerce Web Design. Look out for our new design within the next couple of weeks!

Categories: Magento Tips Tags:

Magento Migration – Permissions

Posted on: 13th Aug 2010 By: Robert Kent No Comments

When you move a Magento site from one hosting server to another you may find that your folder/file permissions do not move across with them. This can cause issues such as images not uploading and the Magento Connect Downloader not working. Very annoying – especially if you’re not expecting it. Also those of you who use Plesk as your hosting platform – when you use the backup and restore manager – the same issue will occur – no folder/file permissions.

Now this problem is a tricky one to solve. There are so many files that you cannot possibly go in and reset them all to their appropriate values. I’ve found that the best trick is to either user ssh access to reset your file permissions or simply to use an FTP client like Filezilla to recursively change them back.

The easiest way to do it – though not really the safest – is to set all permissions to 775. This will give full access to all files and folders for any scripts running on the machine. A lot of people will say this is giving away too much – however if you want to take the time out and go into each folder to set the permissions back you can do – I find it easier to do the whole lot and then maybe go back and set a few which are never used back to 644.

Thanks for visiting our Magento Blog – home of the magento fox here at ecommerce website design.

Categories: Magento Tips Tags: ,

Echo Custom Z Blocks

Posted on: 12th Aug 2010 By: Adam Moss 1 Comment

Aheadworks have developed a great extension called Z Blocks, trouble is parts of the manual can be a bit ropey. It tells you how to set up the XML and configure the admin, but it doesn’t tell you how to call your XML into the your phtml file. For those of you without much Magento experience, knowing how to do this could be quite tricky so here’s the unofficial how-to:

1. Create your Z Block in the admin, I’m going to give mine the position name of ‘footerblock’.

2. Now, as I want my Z block to go in footer.phtml, open app > design > frontend > base > yourtheme > layout > page.xml and inside the footer block (<block type=”page/html_footer” name=”footer” as=”footer” template=”page/html/footer.phtml”>) add in your XML code:

<block type="zblocks/block" name="footer_block">
<action method="setPosition">
<position>footerblock</position>
</action>

3. Finally you just need to call it on the footer.phtml page with this code which you’ll have seen many times before:

<?php echo $this->getChildHtml('footer_block') ?>

If you want to call it in your head, or right or left column,  just relocate the XML and php call out and you’ll be laughing. This technique also works for calling out static blocks in areas of the phtml pages that you wouldn’t otherwise be able to edit. Just use this code to create the static block:

<block type="cms/block" name="new-block">   <action method="setBlockId"><block_id>new-block</block_id></action></block>

<?php echo $this->getChildHtml('new-block') ?>

It’s almost like an instant CMS! Keep reading the Magento Blog at Ecommerce Web Design for more hints and tips.

Categories: Magento Tips Tags: