freejojoey Posted January 8, 2005 Posted January 8, 2005 I need to make the "add to cart" button unavailable for 9 products in my catalog. The client has requested that I put an image in it's stead that directs the customer to call for availability... could someone help me with this? I'm not that great with integrating javascript into php... but i drafted my if statement below between the reviews button and the add to cart button-- i hope what i wrote makes sense... thanks to anyone for assistance... <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> if products_id=1,2,3,4,5,6,7,8,9 display img src="images/call.gif" else display td below <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
mwakeham Posted January 8, 2005 Posted January 8, 2005 if products_id=1,2,3,4,5,6,7,8,9display img src="images/call.gif" else display td below Why are you doing this in Javascript? Why not just do it in PHP? Its so much easier. Myles
freejojoey Posted January 8, 2005 Author Posted January 8, 2005 i suppose it would be just as easy huh? so if you would like to help me with that, I'm open to it... I'm just learning the php :blush:
Simmy Posted January 8, 2005 Posted January 8, 2005 could you not set the stock level for those products to zero then just use a check for stock level to decide whether or not to show the add to cart button. Hard coding it into your pages as you suggest will come back and bite you in the ass when the products need to be changed!
freejojoey Posted January 8, 2005 Author Posted January 8, 2005 could you not set the stock level for those products to zero then just use a check for stock level to decide whether or not to show the add to cart button. Hard coding it into your pages as you suggest will come back and bite you in the ass when the products need to be changed! <{POST_SNAPBACK}> that was my initial response when the client requested this, however, if i mark it out of stock, it doesn't show up on the index page in the "new products"... and the client wishes it to be displayed there. he just doesnt want anyone ordering this product without calling to check the availability of it first-- he's a paintball gun manufacturer, and he only makes a few guns at a time... thank you for your suggestions though... i'm open to anything right now! if you have any other ideas i'd love to hear them...
freejojoey Posted January 8, 2005 Author Posted January 8, 2005 :'( I'm still looking for something similar to this if statement throughout the php in the files... could anyone help me write an "if, then, else" statement in php??? thanks in advance...
Guest Posted January 8, 2005 Posted January 8, 2005 If stock =0 dont allow checkout. In configuration?
etepalusip Posted January 8, 2005 Posted January 8, 2005 Here's half of it....this works for me for products listed with no price: in product_info.php, around line 196, <?php if ($products_price > 0) { ?> <td class="main" align="center"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <?php } ?> replaces <td class="main" align="center"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> funny, i actually needed it for my site but hadn't gotten around to doing it til now for a "SOLD" category we have. you'll still need to add an 'if' statement to add the new image pete http://www.RouseArtCo.com
freejojoey Posted January 8, 2005 Author Posted January 8, 2005 This is what I ended up doing: <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <!--if products_id equals whatever, display the call-us gif, otherwise, display the add to cart button--> <?php if ($products_id == 36 || $products_id == 37 || $products_id == 31 || $products_id == 42 || $products_id == 43 || $products_id == 44 || $products_id == 59 || $products_id == 60 || $products_id == 52 || $products_id == 53 || $products_id == 28) { ?> <img src="http://chipleymachine.com/store/images/call.gif" border="0" alt="Call for availability"> <?php } else { ?><td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <?php } ?> Thank you everyone for your help...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.