Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Related Products - Buy Now Button


Recommended Posts

I am trying to add the Buy Now button back into the Optional Related Products 5.6 module (http://addons.oscommerce.com/info/8057), in the original directions for the addon it gave these instructions:

8) Add support for the Buy Now button to application_top.php

    8a) [catalog/]includes/application_top.php (around line 321)
        Find:

            if (DISPLAY_CART == 'true') {
              $goto =  FILENAME_SHOPPING_CART;
              $parameters = array('action', 'cPath', 'products_id', 'pid');
            } else {
              $goto = basename($PHP_SELF);

        Replace with:
            if (DISPLAY_CART == 'true') {
              $goto =  FILENAME_SHOPPING_CART;
              $parameters = array('action', 'cPath', 'products_id', 'pid');
        /* Optional Related Products (ORP) */
            } elseif ($HTTP_GET_VARS['action'] == 'rp_buy_now') {
              $goto = FILENAME_PRODUCT_INFO;
              $parameters = array('action', 'pid', 'rp_products_id');
        //ORP: end
            } else {
              $goto = basename($PHP_SELF);

    8b) [catalog/]includes/application_top.php (around line 384)
        Find:
          case 'notify' :         if (tep_session_is_registered('customer_id')) {

        Replace with:
         /* Optional Related Products (ORP) */
          case 'rp_buy_now' :     if (isset($HTTP_GET_VARS['rp_products_id'])) {
                                    if (tep_has_product_attributes($HTTP_GET_VARS['rp_products_id'])) {
                                      tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['rp_products_id']));
                                    } else {
                                      $cart->add_cart($HTTP_GET_VARS['rp_products_id'], $cart->get_quantity($HTTP_GET_VARS['rp_products_id'])+1);
                                    }
                                  }
                                  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                                  break;
          //ORP: end
          case 'notify' :         if (tep_session_is_registered('customer_id')) {

Is there any way to add the button functionality without touching application_top.php?

osCommerce user since 2003! :thumbsup:

Link to comment
Share on other sites

Hi,

yes its possible with hook actions, but you have to write this button app. Action $parameters could be well separated if you use unique action=rp_buy_now

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Thank you Gergely, good to know it can be done.

 

I'm not sure what you mean when you say "Action $parameters could be well separated if you use unique action=rp_buy_now"

osCommerce user since 2003! :thumbsup:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...