Simple Configurable Products 404 Error

So because Magento V1 is horrible at handling Configurable Products, a lot of us are forced to use the prodigal SCP Extension (Simple Configurable Products) which, much like the Ryugyong Hotel, just stopped being supported. Thankfully, a lot of the features still work, but there are some issues which have been fixed by the community.

One such issue is one I’ve encountered when I tried adding a quantity of product which exceeded the availability. Because the simple product isn’t visible in the store (it’s hidden because it’s associated with the configurable product), you’re taken to a 404 page. As far as Magento is concerned, the product doesn’t exist.

After weeks of fudging this (using plugins to cover it up basically), someone posted a fix on the plugins github:

The exact fix is here.

Basically, all you need to do is append some code onto a couple of the plugin files and the plugin now redirects to the configurable product and NOT the out of stock hidden simple product.

Magento – All CMS Pages in a list w/ current page highlighted

Ok, so this might be easy for a seasoned Magento Front Ender to work out, but it’s always nice to have this type of code available for people to copy and paste.

Sometimes, you’ll be required to output a list of CMS pages on your store for easier navigation for the user. In this case, I was asked to add a sidebar to all CMS pages containing other active pages.

Firstly, create a page in your theme folder, something like template/page/html/cmsPages.phtml

Pop the following code in the file:

<?php 
	$currIdent = Mage::getSingleton('cms/page')->getIdentifier(); //We need the identifier of the current page for later use
	$currTitle   = Mage::getSingleton('cms/page')->getTitle();
?>

<div class="related-pages">
	<h2><?php echo $currTitle; ?></h2>
		<?php 
		 $pages = Mage::getModel('cms/page')->getCollection()
		        ->addFieldToFilter('is_active',1)
		        ->addFieldToFilter('identifier',array(array('nin'=>array('privacy-policy','terms-conditions')))); //Use this to exclude any pages you don't want in the list
		?>
		<ul>
			<?php
				foreach($pages as $page)
				{
				    //var_dump($page->getData()); //Unquote this if you want to see other attributes.
				    $ident = $page->getIdentifier(); //Identifier of page in loop
				    if ($ident == $currIdent) { //If current page identifier matches looped identifier
				    	$class = 'class="current"'; 
				    }else{
				    	$class = '';
				    }
					echo '<li ' . $class .'><a href="' . $this->getUrl($ident) .'">' . $page->getTitle() . '</a></li>'; 
				}
			?>
		</ul>
</div>

Once that’s created, go into your local.xml and add the following to all CMS pages. This is under the assumption that your CMS pages contain a right or left block:

    <cms_page>
        <reference name="right">
            <block type="page/html" name="cms_list" as="cms_list" template="page/html/cmsPages.phtml" />  
        </reference>
    </cms_page>

And there we go. Simple as that!

Magento – Emails not being sent out DESPITE cron.php being enabled and running

For the past 2 weeks or so, I’ve been pulling my hair out over an issue whereby order emails weren’t being sent out.
These are the most common questions I encountered on Google:

  • Was a cronjob set up correctly? You bet your arse it was.
  • Were emails sending out from the server? Yep, they were!
  • Have you installed AOE scheduler? Yes I have! (Wonderful piece of kit by the way)
  • Are you an idiot? Yes, I probably am.

After checking many MANY times those questions were answered, I stumbled across another StackOverflow question which I somehow missed, it suggested the following:

Edit file cron.php

After

 

$isShellDisabled = (stripos(PHP_OS, ‘win’) === false) ? $isShellDisabled : true;

add

 

$isShellDisabled = true;


As soon as that was saved, I got literally 500 emails containing “too late for schedule”. I made sure the timings matched the cron settings on Config > Advanced > System > Cron (ie, 15 minutes in the crontab = 15 minutes in the cron settings) – and BAM! My old orders came through, as did my tears of joy and relief.

The other question I have is that why wasn’t this running when other Magento installs I’ve worked with have no trouble?

TBC…

 

EDIT – Another interesting link which might cause discrepancies with the cronjob heartbeat error – http://magento.stackexchange.com/questions/82979/magento-1-9-2-1-cron-not-working