Jump to content

Recommended Posts

Hi,

 

I was wondering if someone could point me in the right direction?

I would like to change the function of a button on my site (the add to cart button), so instead of adding to the shopping cart it actually pulls from the database a url (based on the id of the item) and takes the customer there.

I can change the button into a simple hyperlink, but I need to pull the url from the d/b based on the product id and then turn that info into a hyperlink

 

I would really appreciate someone pointing me in the right direction (as you can tell I am new to php)

 

:-\

Link to comment
https://forums.phpfreaks.com/topic/254839-change-the-functuion-of-a-button/
Share on other sites

Thanks.

 

I am using oscommerce

here is the add to cart code

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

I need to change the code to pull a url (which is already loaded in the d/b) from the table "products" in the column products url based on the products id also in the "products" table and then have the customer directed to that url.

 

Thanks

 

Sorry here is the code from Application_top.php

// customer adds a product from the products page

      case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

                                $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';

                                $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);

                              }

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                              break;

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.