bungiuk Posted January 11, 2012 Share Posted January 11, 2012 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) :-\ Quote Link to comment Share on other sites More sharing options...
scootstah Posted January 12, 2012 Share Posted January 12, 2012 This should be in here: http://www.phpfreaks.com/forums/index.php?board=107.0 Post what you are using for a cart system and relevant code and you will get a better response. Quote Link to comment Share on other sites More sharing options...
bungiuk Posted January 12, 2012 Author Share Posted January 12, 2012 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 Quote Link to comment Share on other sites More sharing options...
bungiuk Posted January 12, 2012 Author Share Posted January 12, 2012 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.