Jump to content

IainMHamilton

Members
  • Content count

    9
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Iain Hamilton

Recent Profile Visitors

2,428 profile views
  1. IainMHamilton

    no stock button in product_info

    I've just noticed there is a Stock option in the Configuration side of things so setting the Out Of stock level should logically be done there. Functionally it makes no difference, but if you want to make this change you need to :- 1. Run the following against the database update configuration set configuration_key='STOCK_OUT_OF_STOCK',configuration_group_id=9,sort_order=6 where configuration_key='MAX_OUT_OF_STOCK'; 2. Update the following five files and change MAX_OUT_OF_STOCK to STOCK_OUT_OF_STOCK a) "\templates\default\includes\components\product_listing.php" b) "\includes\modules\content\index\templates\tpl_cm_i_card_products.php" c) "\includes\modules\content\index_nested\templates\tpl_cm_in_card_products.php" d) "\includes\modules\pi\product_info\templates\tpl_pi_add_to_cart_button.php" e) "\includes\modules\pi\product_info\templates\tpl_pi_out_of_stock.php"
  2. IainMHamilton

    no stock button in product_info

    Hi, I have created the following add-ons for the PI system that should help - 1. An Add to Cart button that has a test for a minimum stock level - based on the Buy Button code. 2. An Out of Stock message that also has a test for a minimum stock level - based on the Product Model code. In addition update the code in the following files to make the same test against the minimum stock level - this is for the product listing cards; 1. in "includes\languages\english.php" add the line const PRODUCT_OUT_OF_STOCK = 'Out of Stock'; 2. in "\templates\default\includes\components\product_listing.php" (around line 132) replace if ($has_attributes == 0) $prod_list_contents .= tep_draw_button(IS_PRODUCT_BUTTON_BUY, '', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . (int)$listing['products_id']), NULL, array('params' => 'data-has-attributes="' . $has_attributes . '" data-in-stock="' . (int)$listing['in_stock'] . '" data-product-id="' . (int)$listing['products_id'] . '"'), 'btn-light btn-product-listing btn-buy') . PHP_EOL; with if ($has_attributes == 0) { if ((int)$listing['in_stock'] > MAX_OUT_OF_STOCK) { $prod_list_contents .= tep_draw_button(IS_PRODUCT_BUTTON_BUY, '', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . (int)$listing['products_id']), NULL, array('params' => 'data-has-attributes="' . $has_attributes . '" data-in-stock="' . (int)$listing['in_stock'] . '" data-product-id="' . (int)$listing['products_id'] . '"'), 'btn-light btn-product-listing btn-buy') . PHP_EOL; } else { $prod_list_contents .= '<span style="background:#F8D7DA;margin:2px;padding:.375rem .75rem;">'.PRODUCT_OUT_OF_STOCK.'</span>'; } } 3. in "\includes\modules\content\index\templates\tpl_cm_i_card_products.php" (around line 31) replace if ($has_attributes == 0) echo tep_draw_button(IS_PRODUCT_BUTTON_BUY, '', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id', 'sort', 'cPath')) . 'action=buy_now&products_id=' . (int)$card_products['products_id']), NULL, array('params' => 'data-has-attributes="' . $has_attributes . '" data-in-stock="' . (int)$card_products['in_stock'] . '" data-product-id="' . (int)$card_products['products_id'] . '"'), 'btn-light btn-product-listing btn-buy') . PHP_EOL; with if ($has_attributes == 0) { if ((int)$card_products['in_stock'] > MAX_OUT_OF_STOCK) { echo tep_draw_button(IS_PRODUCT_BUTTON_BUY, '', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id', 'sort', 'cPath')) . 'action=buy_now&products_id=' . (int)$card_products['products_id']), NULL, array('params' => 'data-has-attributes="' . $has_attributes . '" data-in-stock="' . (int)$card_products['in_stock'] . '" data-product-id="' . (int)$card_products['products_id'] . '"'), 'btn-light btn-product-listing btn-buy') . PHP_EOL; } else { echo '<span style="background:#F8D7DA;margin:2px;padding:.375rem .75rem;">'.PRODUCT_OUT_OF_STOCK.'</span>'; } } 4. in "includes\modules\content\index_nested\templates\tpl_cm_in_card_products.php" (around line 31) replace if ($has_attributes == 0) echo tep_draw_button(IS_PRODUCT_BUTTON_BUY, '', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id', 'sort', 'cPath')) . 'action=buy_now&products_id=' . (int)$card_products['products_id']), NULL, array('params' => 'data-has-attributes="' . $has_attributes . '" data-in-stock="' . (int)$card_products['in_stock'] . '" data-product-id="' . (int)$card_products['products_id'] . '"'), 'btn-light btn-product-listing btn-buy') . PHP_EOL; with if ($has_attributes == 0) { if ((int)$card_products['in_stock'] > MAX_OUT_OF_STOCK) { echo tep_draw_button(IS_PRODUCT_BUTTON_BUY, '', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id', 'sort', 'cPath')) . 'action=buy_now&products_id=' . (int)$card_products['products_id']), NULL, array('params' => 'data-has-attributes="' . $has_attributes . '" data-in-stock="' . (int)$card_products['in_stock'] . '" data-product-id="' . (int)$card_products['products_id'] . '"'), 'btn-light btn-product-listing btn-buy') . PHP_EOL; } else { echo '<span style="background:#F8D7DA;margin:2px;padding:.375rem .75rem;">'.PRODUCT_OUT_OF_STOCK.'</span>'; } } The Product Cards will now either display the cart button or an out of stock message. In addition there is an SQL insert that needs to be run against the database to add the Stock Level that is considered "Out of Stock". This adds the out of stock option to Configuration>Maximum Vales in administration. I have set the Out of Stock level to 0 and the sort_order to 4. insert into configuration ( configuration_title,configuration_key,configuration_value,configuration_description,configuration_group_id,sort_order,date_added ) values ( 'Out of Stock Level','MAX_OUT_OF_STOCK','0','At or Below this number (in stock) means the item is considered Out of Stock',3,4,now() ); To implement the changes 1. Copy on the new php files for the pi system. 2. Make the changes to the four files detailed above. 2. Update the database to add the new row to the configuration table. 3. In administration go into Layout Modules>Product Info & install and configure the two new modules. Disable the Buy Now module. 4. In administration go into Configuration>Maximum Values and set the value that is considered Out of Stock if you wish to use a value other than 0. Hopefully, that should give you what you want. Note that to change the 'Out of Stock' message you need to update both "includes\languages\english.php" and also "includes\languages\english\modules\pi\product_info\pi_out_of_stock.php". If you want you can change the definition in the latter to const PI_OUT_OF_STOCK_WARNING = PRODUCT_OUT_OF_STOCK; but that ties the PI module to the english.php update, so I haven't made that change in the file in the zip. There is probably a better way to update the product listing cards without changing the code - I'd be interested to know the details if there is. OutOfStock.zip
  3. IainMHamilton

    Sage Pay 1.2

    Hi, For anyone who may be interested, I finally managed to track down where this is going wrong. in application_top.php, we have the following piece of code :- if (SESSION_FORCE_COOKIE_USE == 'True') { if (!isset($HTTP_COOKIE_VARS['cookie_test'])) { tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain); } if (isset($HTTP_COOKIE_VARS['cookie_test']) { tep_session_start(); $session_started = true; } } when the SagePay Server was posting the callback this code was failing - ie the "cookie_test" cookie was not being found, even after an attempt to create it. Eventually, the login page was called. I changed the second test to be :- if ((isset($HTTP_COOKIE_VARS['cookie_test'])) || ($PHP_SELF=='checkout_process.php')) { tep_session_start(); $session_started = true; } and the code works OK (it always had a valid oscid). Checking the referrer is indeed the SagePay production server will make sure this only works for callbacks from that site. If anyone can shed some light on why the setcookie fails, I would be interested to know.
  4. IainMHamilton

    Sage Pay 1.2

    Hi, I have installed the SagePay server v 1.2 module on oscommerce 2.3.3. I am using the Server method when accessing SagePay. I have a VPS hosted solution with it's own SSL certificate. Everything works fine until I set FORCE_SESSION_COOKIES to true. If it is set to true, the system returns the login page from the initial redirect. I have ultimate SEO installed, but version 1.2 of the SagePay module contains code to work around the "&" to "amp" conversion problem documented elsewhere. Switching SEO on/off makes no difference. Switching W3C URL's on/off makes no difference. Can anyone point me in the direction of a fix or give some clues how to fix this. Thanks
  5. IainMHamilton

    ULTIMATE Seo Urls 5 - by FWR Media

    Hi, For those that follow, I found this post on page 165 of this thread, which fixed my problem. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< FWR Media, on 15 May 2011 - 06:03 PM, said: You don't need to do anything except read the instructions. As standard Remove all non-alphanumeric characters? is on, this strips all non alphanumeric characters. This didn't work for me. I thought it was because I use the utf-8 character set. So I included '™' => '', '©' => '', '®' => '' to my character conversion table. But now I found this line in page_modules.php: $pattern = ( defined( 'SEO_REMOVE_ALL_SPEC_CHARS' ) && SEO_REMOVE_ALL_SPEC_CHARS == 'true' ) ? "@[^\sa-z0-9]@i" : "@[!#\$%&'\"()\*\+,\-\./:;<=>\?\@\[\]\^_`\{|\}~]+@"; after changing this line to: $pattern = ( defined( 'USU5_REMOVE_ALL_SPEC_CHARS' ) && USU5_REMOVE_ALL_SPEC_CHARS == 'true' ) ? "@[^\sa-z0-9]@i" : "@[!#\$%&'\"()\*\+,\-\./:;<=>\?\@\[\]\^_`\{|\}~]+@"; it worked as you described. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  6. IainMHamilton

    ULTIMATE Seo Urls 5 - by FWR Media

    Hi, I am using this contribution with version 2.3.3. Everything is working well except for a few products which have Gaelic names - eg Grá Mo Chroí An Óige. An example is here http://www.thedancinghaggis.com/index.php/gearoidin-breargnach-m-25658, which, if you click on the link to the CD, gives you a problem. I wonder if anyone can point me in the right direction. Thanks
×