May 31, 2015

OpenCart remove category image




To remove OR hide category image and just show the category description please follow below:

First Go: catalog\view\theme\default\template\product\category.tpl

Note: Here 'default' you can change as per your theme folder name.

In category.tpl file find the below code:

<table style="padding-bottom:10px;">
  <tr>
    <?php if ($thumb) { ?>
       <td><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" /></td>    
    <?php } ?>
    <?php if ($description) { ?>
       <td><?php echo $description; ?></td>
    <?php } ?>
  </tr>
</table>



And then replace with below new code:

<table style="padding-bottom:10px;">
  <tr>
    <?php if ($description) { ?>
       <td><?php echo $description; ?></td>
    <?php } ?>
  </tr>
</table>




Enjoy!

May 28, 2015

Script to direct redirect PayPal form to PayPal site without click on button


if you want direct redirect PayPal form to PayPal site when page is load without click on button then just add this script after form.

<script>
document.getElementById('formID').submit();
</script>

Enjoy!

PHP PayPal sandbox form for testing.



The following form just display 'Buy Now' button for PayPal sandbox and its redirect to PayPal site when you can click on that button.

- You can easily change item_name, amount, return URL, business email.

<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post" id="payfrm">
 <input type="hidden" name="cmd" value="_xclick">
 <input type="hidden" name="business" value="phpdeveloper@gmail.com">
 <input type="hidden" name="currency_code" value="USD">
 <input type="hidden" name="item_name" value="PHP Learning Book">
 <input type="hidden" name="return" value="http://domainname.com/success.php">
 <input type="hidden" name="amount" value="20">
 <input type="image" src="./form_files/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it&#39;s fast, free and secure!">
</form>

- If you want PayPal live site then just change action URL: https://www.paypal.com/webscr

Enjoy!

May 27, 2015

MySQL find string and replace using query



Yes, its possible to find string from database and direct replace new string using SQL query.

See the following example.

"update your_table_name set fieldname = replace(fieldname, ‘string to find’, ‘new string which you want replace’)"

Enjoy!

May 26, 2015

Woocommerce how to add to cart button direct redirect to checkout page?

Yes its possible using a simple wordpress function.

Please add following function in your theme functions.php file.

add_filter ('add_to_cart_redirect', 'redirect_checkout');

function redirect_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
}

In the latest version of wordperss you also used following shot function.

function redirect_to_checkout() {
    return WC()->cart->get_checkout_url();

}

Enjoy!

May 21, 2015

Disable/Hide product review in OpenCart.

Please follow the below step to disable OR hide product review options from product page.

1. First login into site admin.

2. After login admin go to left side System > settings.

3. Click on edit icon on right side of store name.

4. And then select option tab from top part.

5. Under Reviews section find Allow Reviews and select option No, If you want to disable and in feature if you want to enable then select Yes option.

6. Save the setting from top right side.



Enjoy!

May 18, 2015

jQuery select box onchange window.location

Give the same name of select box ID and jQuery ID.

<select id="redirect" onchange="window.location = jQuery('#redirect option:selected').val();">
 <option value="http://www.google.com">Great Site</option>
 <option value="http://www.yahoo.com">Better Site</option>
</select>

Enjoy!

May 12, 2015

How To Destroying OR Unset Session in PHP?

When you used multiple session with different name and If you want any one session destroy OR unset then used following syntax:

<?php
session_start();
unset($_SESSION['session_name']);
?>

And If you want destroy all session name and data after success process then used following syntax:

<?php
session_start();
session_destroy();
?>

Enjoy!

May 6, 2015

Find maximum value from numbers using PHP.

$no = 5;
$no2 = 10;
$no3 = 6;
$maxVal = max($no,$no2,$no3);
echo $maxVal;

Result:
10

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...