CC_DESIGN Posted April 5, 2007 Share Posted April 5, 2007 Hi, I have an online store and i have recently added an out of stock module. The module works perfectly on all pages apart from my new products page. On the new products page people can buy items straight away by click a buy now button next to the item details. This is displayed with this code: <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?> If i delete this code i can get rid of the add to cart/buy it now button on the new products page but im left with a nice big white space. What i would like to do is add a different button called - product_details - which links to the product details page. At the moment on the same page, the products name links to the products details page and this is the code used there: <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br> The next line of code is, just date product added and more details but this is the code that links teh product name through to the product details page. ok i think thats all the code you need but i don't really know that much about PHP, i can follow it slowly but making chages apart from deleting parts is not my strong point. Can some one change my first section of code to link to the products description page rather than the buy now command its doing at the moment? Any more info needed please let me know. CC_DESIGN Link to comment https://forums.phpfreaks.com/topic/45720-change-some-php-code-on-my-shopping-cart-help/ Share on other sites More sharing options...
CC_DESIGN Posted April 5, 2007 Author Share Posted April 5, 2007 I have just tried doing it my self and this is what i come up with which is probably completely wrong: <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"> . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?> For the time being i can see it will still show the buttin_in_cart.gif image which is a a button image saying add to cart but i will create a new button later on. When i use this bit of code, it doesn't close properly. What i mean by this is that i use dreamweaver and it seperate all types of code out with different colours. The next bit of code is all in red after i add this and i think its becuase its not closing properly. If i've done something completely wrong, i still need help i just thought i'd have a go at merging the above to sections and seeing the result which didnt work. CC_DESIGN Link to comment https://forums.phpfreaks.com/topic/45720-change-some-php-code-on-my-shopping-cart-help/#findComment-222110 Share on other sites More sharing options...
CC_DESIGN Posted April 5, 2007 Author Share Posted April 5, 2007 ok just looked over it again and noticed i missed a bit out <b><u>' at the end of the first section <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"> so it is now <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?> I dont know what the bit i missed out mean but it seems to have fixed it I have uploaded and checked and it shows the add to cart button but instead of addding the item to the cart it goes through to the product info page as required. Now i just need to figure out how the image works I know i'm answering my own questions but if someone could confirm what im doing is right because i really don't know i'm just doing trial and error. CC_DESIGN Link to comment https://forums.phpfreaks.com/topic/45720-change-some-php-code-on-my-shopping-cart-help/#findComment-222114 Share on other sites More sharing options...
CC_DESIGN Posted April 5, 2007 Author Share Posted April 5, 2007 Ok got it all working now. This is the final code: <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . tep_image_button('product_details.gif', IMAGE_PRODUCT_DETAILS) . '</a>'; ?> CC_DESIGN Link to comment https://forums.phpfreaks.com/topic/45720-change-some-php-code-on-my-shopping-cart-help/#findComment-222128 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.