Remove weight from cart/checkout – (Opencart Weight Based Shipping)

If you are using the Weight Based Shipping module in Opencart you may find that the weight appears in certain places such as the cart and checkout. However, you may not want this displayed as your weight might not be accurately setup or you may have it configured in your own way.

There is a setting to disable weight in the Opencart settings however this does not fully remove all references to the weight.

To fully remove the weight reference we need to edit the file:
catalog/model/extension/shipping/weight.php

Scroll down and find the line:

 'title' => $result['name'] . ' (' . $this->language->get('text_weight') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')',

Simply replace this line with the following:

 'title' => $result['name'],

Adding Adwords Conversion code to Opencart Checkout

Google Adwords Conversions can be very useful for tracking what purchases on your site come from paid clicks through a PPC campaign.

Firstly you need to set up the tracking code on your Adwords account:
https://support.google.com/adwords/answer/6095821

To setup the conversion for an Opencart store we are going to track the success page that appears after a successful checkout. This is the page that lives at: catalog/view/theme/your-theme/template/common/success.tpl

However, this page is also used for all other success pages, for example after filling out any form. Therefore we need to check that the use has just completed the checkout page. We do this with a PHP query to check the route of the page we are on.

<?php $url_link_path = $_SERVER['QUERY_STRING'];;

if ($url_link_path = “route=checkout/success”) { ?>

//Insert Adwords Conversion Code Here

<?php } ?>

How to move position of Customize button – Fancy Product Designer

If you are using the Fancy Product Designer wordpress plugin and need to move the  location of the “Customize Product” button I will show you how.

Find the file called class-frontend-product.php, it lives in the inc/ folder of the plugin.

Find the code below:

//add customize button
add_action( ‘woocommerce_single_product_summary’, array( &$this, ‘add_customize_button’), 25 );

 

The wordpress codex shows how this add_action() function works:

<?php add_action( $hook, $function_to_add, $priority, $accepted_args ); ?>

 

The $priority variable (set as 25) is what determines where the customise button is echoed out on the product page.

  • To display the Customize button above the product title change the priority from 25 to 1
  • To display the Customize button just below the product title and price change the priority from 25 to 10

 

How To Allow Additional Upload File Types in WordPress

how-to-add-mime-types-wordpress
Many file types you may want to upload to your WordPress blog or site will not be allowed by default. This is down to security concerns; uploading incorrect files etc that could bring down the site or introduce vulnerabilities. If you know what you are doing here is how to unlock any file type you want.

Don’t feel comfortable editing core files? Have a look through the plugins available.

A list of the default allowable file types for uploading is available here.

  1.  Find the functions.php within the folder: wp-includes/
  2.  Scroll down to the function: function wp_get_mime_types() {}
  3. Add a new line in the appropriate section, or the MISC section if you are unsure. For example, for adding the XML file type, insert the following line:‘xml’ => ‘application/xml’,Once you saved/uploaded you will be able to upload XML files within WordPress.List of all MIME types explained available here.

 

You may also want to take a look at How to Increase Your WordPress Memory Limit

How to increase PHP memory limit for wordpress

If you run into a problem where your wordpress page is coming up blank or timing out there is a good chance the PHP memory is timing out. Have a look in your server’s error.log file and you might see something like the following

[08-Sep-2014 12:35:06 UTC] PHP Fatal error:  Allowed memory size of 50331648 bytes exhausted (tried to allocate 7680 bytes) in /home/...

A quick way of fixing this without going near the php.ini file is by going to the wp-config.php file and entering the following:

define('WP_MEMORY_LIMIT', '64M');

PHP/SQL OOP Register & Login System