emptyspaces Posted March 3, 2006 Share Posted March 3, 2006 I need to insert the product name for each item in my shopping cart. Does anyone have an idea of what code I need to drop in? thanks.. Seth Link to comment Share on other sites More sharing options...
wheeloftime Posted March 3, 2006 Share Posted March 3, 2006 I need to insert the product name for each item in my shopping cart. Does anyone have an idea of what code I need to drop in? thanks.. Seth My shopping cart always did show the product names by default ?! Maybe you can be a bit more specific about what you want to achieve and where. Link to comment Share on other sites More sharing options...
emptyspaces Posted March 4, 2006 Author Share Posted March 4, 2006 My shopping cart, using a template from template monster, was written to show a picture of the product instead of displaying the product name. I have a client who does not want to use pictures... This leaves me with nothing inside the product column, but the price and quanity are filled in. I would like to know whether there is a built in function that I can call that pulls product name from the database, so that I can cut and past it into the shopping cart php file and have it display something in the product column. Seth Link to comment Share on other sites More sharing options...
wheeloftime Posted March 4, 2006 Share Posted March 4, 2006 My shopping cart, using a template from template monster, was written to show a picture of the product instead of displaying the product name. I have a client who does not want to use pictures... This leaves me with nothing inside the product column, but the price and quanity are filled in. I would like to know whether there is a built in function that I can call that pulls product name from the database, so that I can cut and past it into the shopping cart php file and have it display something in the product column. Seth Sure function tep_get_products_name($product_id, $language = '') Take a look at the original shopping_cart.php also to get some more ideas. Link to comment Share on other sites More sharing options...
emptyspaces Posted March 5, 2006 Author Share Posted March 5, 2006 I can't get the above code to work.. This is the current code. I think this is where the name is supposed to be displayed. Currently it just shows an image and any product option I create in the admin section.. Does't list the product name. $products_name = '<table border="0" cellspacing="2" cellpadding="2" width=100%>' . ' <tr>' . ' <td colspan=2 class="ZZZproductListing-data" align="center" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=image_border') . '</a></td>' ; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; Link to comment Share on other sites More sharing options...
wheeloftime Posted March 5, 2006 Share Posted March 5, 2006 I can't get the above code to work.. This is the current code.I think this is where the name is supposed to be displayed. Currently it just shows an image and any product option I create in the admin section.. Does't list the product name. $products_name = '<table border="0" cellspacing="2" cellpadding="2" width=100%>' . ' <tr>' . ' <td colspan=2 class="ZZZproductListing-data" align="center" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=image_border') . '</a></td>' ; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; That is because the products name is nowhere added to the display in this code. With the tep_image function you see products[$i]['name'] being used for the ALT tag of the image and that is the one you can use also for adding the product name. You don't need any extra function for that, just dispaly products[$i]['name'] where you want it. I.e. $products_name = '<table border="0" cellspacing="2" cellpadding="2" width=100%>' . ' <tr>' . ' <td colspan=2 class="ZZZproductListing-data" align="center" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=image_border') . '<br>' . $products[$i]['name'] . '</a></td>'; Link to comment Share on other sites More sharing options...
emptyspaces Posted March 5, 2006 Author Share Posted March 5, 2006 Like a dream. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.