willid Posted June 14, 2016 Share Posted June 14, 2016 I have managed to install some text/image (currently text) in the Account History/Order Information of customers which allows them to "add item to cart" again or if end of line shows "item no longer stocked". I do not do PHP usually so this is my first attempt, I know it is not right but it is working so I am asking for help to do it right if possible. // START INSERT ADD TO CART BUTTON $products_info_query = tep_db_query("select products_id from products where products_id = '". $order->products[$i]['id'] . "'"); $products_info = tep_db_fetch_array($products_info_query); if ($products_info === NULL) { echo " - <strong>ITEM NO LONGER SOLD</strong> " ; } else { ?> - <a href="account_history_info.php?action=buy_now&products_id=<?php echo $order->products[$i]['id']; ?>"> - <strong>ADD TO CART AGAIN</strong></a> <?php } // END INSERT ADD TO CART BUTTON (This code goes into Account_history_Info.php) I am on version 2.3.4 and any help would be grateful, I am a rookie which took me a few hours to do but trial and error go it doing what I want (even though may be not right) Thanks Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 14, 2016 Share Posted June 14, 2016 Good job for a first attempt. :) I suggest the following instead. But in case you are not aware of it, there is an reorder infobox that you can enable and it will show previously ordered products that can be added to the cart. In the least, you can look at its code to see how it is done. // START INSERT ADD TO CART BUTTON $products_info_query = tep_db_query("select 1 from products where products_id = '". (int)$order->products[$i]['id'] . "'"); if (tep_db_num_rows($products_info_query) == 0) { echo " - <strong>ITEM NO LONGER SOLD</strong> " ; } else { $products_info = tep_db_fetch_array($products_info_query); ?> - <a href="<?php echo tep_href_link('account_history_info.php', 'action=buy_now&products_id=' . $order->products[$i]['id']); ?>"> - <strong>ADD TO CART AGAIN</strong></a> <?php } // END INSERT ADD TO CART BUTTON Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
willid Posted June 15, 2016 Author Share Posted June 15, 2016 Hi Jack, Thanks for the info, I have tried looking for that in the modules but cannot see it. Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 15, 2016 Share Posted June 15, 2016 I assumed you are using the BS version of oscommerce. If not, you may have to add the code to display it. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
willid Posted June 15, 2016 Author Share Posted June 15, 2016 You have lost me there all I know is the version is 2.3.4 Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 15, 2016 Share Posted June 15, 2016 Then you should be able to install it by going to admin->Modules->Boxes. If you don't see a module named Order History, click on the Install Modules button (upper right), select that module and install it. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.