Many Opencart users must be aware of this awful problem of Opencart, you can add a product which is out of stock. But you will not be allowed to checkout, which is completely frustrating to the users/shoppers. Recently i was working on an Opencart site and thought of fixing this problem. I was able to fix it without much sweat.
I am sharing it for all those Opencart users who wants to change the Add to Cart button to Out of Stock, for products which are not available.

Rule of the Thumb: Backup the said file before doing anything, in case anything bad happens.

Fire up your FTP program or your cPanel, and then open the following php file

/public_html/catalog/view/theme/emanipur/template/product/product.tpl

Please note that the theme name will differ from site to site. For this tutorial, i am using emanipur as the theme name.

After opening that file, find the Add to cart button which is somewhat like this 

<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button cart-product" />

Please note that the button Id and class may be different for your theme. The only thing you need to look out is the $button_cart value.

Now, remove the above lines and change with the following slightly modified code

<?php if ($stock == "In Stock")
     {
          ?>
               <input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button cart-product" />
         <?php }
               else
                  {
           ?>
              <a class="button" style="font-size:16px;">Out of Stock</a>
         <?php
                  }
          ?>

That's it. Now instead of that Add to Cart button, it will be replaced by Out of Stock button/text.
Please remember that i am using my own button class for the Out of Stock button, you can create or use your own class to suit your theme appearance.

Feel free to contact us, if you have any problems.
Published in eManipur! Blog
You must have come across Joomla components where the Meta Description are not available and you can't see to override it from the Menu item Meta Tag option. I too came across such thing, so thought how to achieve this. My client was asking me to change the Description as it was displaying a wrong description in Google Search... Thought how i could achieve this thing. Finally came up with this brilliant idea.

Open up your FTP or cPanel File Manager and then navigate to your template folder and then html. In short we are going to use template overrides feature of Joomla. I will not be going into detail what template overrides is.  In the default.php file of your template overrides located at yourtemplate/html/com_your_component_name, just after the code defined( '_JEXEC' ) or die( 'Restricted access' );: add the following

$document =& JFactory::getDocument();
$document->setDescription("Your custom description");



I will here demonstrate for a component called JSPLocation, which is a Location Displaying Component. When you use this Component, it will not include a Meta Description in the source code. lets copy the contents of the folder components/com_jsplocation/views into your local drive.
You will have something like
Meta Description Joomla

Now create a new folder called com_jsplocation inside yourtemplate/html and then another folder called jsplocation. Inside this folder upload the contents of components/com_jsplocation/views/jsplocation/tmpl which you just downloaded in the above steps.

You will have 3 files called default.php, default.xml and index.html.

Open up default.php in a text editor and then edit it, check the image below

Adding The Description Code


That's it now check your Source code...

Please note that this hack is only for Joomla 2.5+ and higher versions only.
Published in eManipur! Blog

Our Services

  • Web Design & UX Design
  • eCommerce sites
  • Social Media Marketing
  • Joomla Upgrade and troubleshooting
  • Blogging
  • Website Maintenance

Latest Offer from eManipur!

Joomla   Upgrade Your Old Joomla Website For Free*.
   For More Information click on the Link Below.

Upgrade Joomla

Drop in here

Keishamthong Elangbam Leikai,
Imphal -795001,
Manipur, India

Emanipur Location

Call

+91 97742 70 499

Subscribe to our Tips

Receive our tips and hacks right into your Inbox. We promise you, it will be be a unique experience for you.


Receive HTML?

Social Icon
Facebook    Linked In    Gplus     Twitter