Jump to content
Latest News: (loading..)

Recommended Posts

I needed to change the appearance of the out of stock message inside the shopping_cart.php to save some space when viewing the shop in sm or xs mode so i came up with this tiny little change which i would like to share.

 

=============================================================================

 

what did i do:

 

removed *** and replaced with background color for better and easier viewing.
deactivated checkout button inside the shopping_cart.php if allow checkout is set to false

 

changed files:

 

general.php
shopping_cart.php

includes/languages/english/shopping_cart.php

 

=============================================================================

inside the general.php
*(you can change the color code of the background here and don't forget to adjust the message text to your color.)

find this code around line 139
 

    if ($stock_left < 0) {
      $out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
    }

   
replace with
 

    if ($stock_left < 0) {
      //$out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
      $out_of_stock = '<tr style="background:#ffffb1;">';
    }

inside the shopping_cart.php

find this code around line 80
 

$products_name .= '<tr>';

replace with
 

      if (STOCK_CHECK == 'true') {
            $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
            if (tep_not_null($stock_check)) {
              $any_out_of_stock = 1;

              $products_name .= $stock_check;
            }  else {
             $products_name .= '<tr>';
            }
          }
      //$products_name .= '<tr>';

find this code around line 85
 

      if (STOCK_CHECK == 'true') {
        $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
        if (tep_not_null($stock_check)) {
          $any_out_of_stock = 1;

          $products_name .= $stock_check;
        }
      }

     
and replace with

/*
      if (STOCK_CHECK == 'true') {
        $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
        if (tep_not_null($stock_check)) {
          $any_out_of_stock = 1;

          $products_name .= $stock_check;
        }
      }
*/

find this code around line 136

  <div class="buttonSet">
    <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'glyphicon glyphicon-chevron-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success'); ?></div>
  </div>

and replace with

  <div class="buttonSet">
    <?php      
        if ($any_out_of_stock == 1) {
            echo '<div class="text-right" style="cursor:not-allowed;">' . tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'glyphicon glyphicon-chevron-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success disabled') . '</div>';
        } else {
            echo '<div class="text-right">' . tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'glyphicon glyphicon-chevron-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success') . '</div>';
         }
    ?>    
  </div>

inside the includes/languages/english/shopping_cart.php
*(if color is changed text needs to be adjusted here, text for sample color is yellow)

find this code around line 19
 

define('OUT_OF_STOCK_CANT_CHECKOUT', 'Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' dont exist in desired quantity in our stock.<br />Please alter the quantity of products marked with (' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '), Thank you');
define('OUT_OF_STOCK_CAN_CHECKOUT', 'Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' dont exist in desired quantity in our stock.<br />You can buy them anyway and check the quantity we have in stock for immediate deliver in the checkout process.');

replace with
 

//define('OUT_OF_STOCK_CANT_CHECKOUT', 'Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' dont exist in desired quantity in our stock.<br />Please alter the quantity of products marked with (' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '), Thank you');
//define('OUT_OF_STOCK_CAN_CHECKOUT', 'Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' dont exist in desired quantity in our stock.<br />You can buy them anyway and check the quantity we have in stock for immediate deliver in the checkout process.');
define('OUT_OF_STOCK_CANT_CHECKOUT', 'Products marked in <u>yellow</u> don\'t exist in desired quantity in our stock.<br />Please alter the quantity of products marked in yellow, Thank you');
define('OUT_OF_STOCK_CAN_CHECKOUT', 'Products marked in <u>yellow</u> don\'t exist in desired quantity in our stock.<br />You can buy them anyway and check the quantity we have in stock for immediate delivery in the checkout process.');

That's it.
 

Edited by Tsimi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×