Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customers Accout History


willid

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...