koollayed Posted October 21, 2010 Posted October 21, 2010 I have a question for Oscommerce. I want to add the product_url link to the view button in the account.php page of my site. I have coded the button but it is not pulling the product_url. It just goes to the home page and not pulling the product_url link. I'm not sure how to add the product_url table to the page. I'm sure its going to or around the below code but when I add the pd.products_url it does not find the table. <?php $orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1' order by orders_id desc limit 3"); while ($orders = tep_db_fetch_array($orders_query)) { if (tep_not_null($orders['delivery_name'])) { $order_name = $orders['delivery_name']; $order_country = $orders['delivery_country']; } else { $order_name = $orders['billing_name']; $order_country = $orders['billing_country']; } ?> I have the button coded as <tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>'"> <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_new['products_url']), 'NONSSL', true, false) . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td> <td class="main" width="80"><?php echo tep_date_short($orders['date_purchased']); ?></td> <td class="main"><?php echo '#' . $orders['orders_id']; ?></td> <td class="main"><?php echo tep_output_string_protected($order_name) . ', ' . $order_country; ?></td> <td class="main"><?php echo $orders['orders_status_name']; ?></td> <td class="main" align="right"><?php echo $orders['order_total']; ?></td> <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td> Not sure how to point the link products_url to the view button. Any help would be greatly appreciated. Thanks
ecartsolutions Posted October 21, 2010 Posted October 21, 2010 Hi In the account.php file, assume it is the order history section. You need the code to view the order than the product. A order may contain more than one products. you may change the account_history_info.php file to suite to your needs. The orders table generally donot store the products id. So, 2 possible solutions: 1. either store the products id as well during checkout and retrieve that to get the link. or 2. try to trace the product id with the products name and display the link accordingly. Regards Shiva Our truest life is when we are in dreams awake. -- Henry David Thoreau --
multimixer Posted October 21, 2010 Posted October 21, 2010 None of the above are necessary. All info needed is already available in file account_history_info.php, provided by classes/order.php What you can do is, to make each product name, as displayed in account_history_info.php to be a link to the product Find the line (in file account_history_info.php) ' <td class="main" valign="top">' . $order->products[$i]['name']; and change it to ' <td class="main" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $order->products[$i]['id']) . '">' . $order->products[$i]['name'] . '</a>'; EDIT: the DB table that contains the info is orders_products My community profile | Template system for osCommerce - New: Responsive | Feedback channel
FIMBLE Posted October 21, 2010 Posted October 21, 2010 The products_id is in there too Shiva Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
koollayed Posted October 21, 2010 Author Posted October 21, 2010 None of the above are necessary. All info needed is already available in file account_history_info.php, provided by classes/order.php What you can do is, to make each product name, as displayed in account_history_info.php to be a link to the product Find the line (in file account_history_info.php) ' <td class="main" valign="top">' . $order->products[$i]['name']; and change it to ' <td class="main" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $order->products[$i]['id']) . '">' . $order->products[$i]['name'] . '</a>'; EDIT: the DB table that contains the info is orders_products Thanks for the reply. I want to have the view button the products URL which is found on the product info page. This is the link you input into admin. Is the product id the same?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.