ce7 Posted March 19, 2020 Share Posted March 19, 2020 Hi, on the new CE1.0.5.0, im trying to make the quote button to show up if the SPECIAL PRICE is 0, the origianl addon code is //+Email For Quote v1.2 if (is_email_for_quote($product_info['products_price'])) { $products_price = show_email_for_quote($product_info); } else if ($new_price = tep_get_products_special_price($product_info['products_id'])) { //-Email For Quote v1.2 and to BUY button part //BOF Email For Quote v1.2 if (!is_email_for_quote($product_info['products_price'])) { echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fas fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-block btn-lg btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); } //EOF Email For Quote v1.2 this is what i tried but it shows Add to the cart and Quote button at the same time for all the products, how do i change it to make only special product price is 0 or product price is 0 then show Quote button, otherwise show Add to cart button? // CE Version but show both Quote & Buy buttons //+Email For Quote v1.2 if (is_email_for_quote($product_info['products_price']) || $product_info['specials_new_products_price'] ==0) { $products_price = show_email_for_quote($product_info); } else if ($new_price = tep_get_products_special_price($product_info['products_id'])) { //-Email For Quote v1.2 Many thanks! Lyn Link to comment Share on other sites More sharing options...
♥ecartz Posted March 19, 2020 Share Posted March 19, 2020 Why do you think that $product_info['specials_new_products_price'] would contain the special's price? The else clause shows how to get the special's price. Perhaps $new_price = tep_get_products_special_price($product_info['products_id']); if (is_email_for_quote($product_info['products_price']) || !new_price) { $products_price = show_email_for_quote($product_info); } else { would do what you want. Always back up before making changes. Link to comment Share on other sites More sharing options...
ce7 Posted March 27, 2020 Author Share Posted March 27, 2020 hi thank you for reply. i managed to make only if special price 0 then show quote button if (is_email_for_quote($product_info['products_price'])) { $products_price = show_email_for_quote($product_info); } elseif ($new_price = tep_get_products_special_price($product_info['products_id'])) { if($new_price==0 && is_email_for_quote($product_info['specials_new_products_price'])){ $specials_price =show_email_for_quote($product_info['specials_new_products_price']); } however I can not disable the Add to Cart button this code can make quote button when product price is 0 ---> is_email_for_quote($product_info['products_price']) if(!is_email_for_quote($product_info['products_price'])){ echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fas fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-block btn-lg btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); } how can i make Add to Cart disappear for both product price is 0 and special product price is 0? Many thanks! Lyn Link to comment Share on other sites More sharing options...
♥ecartz Posted March 27, 2020 Share Posted March 27, 2020 $add_to_cart = false; if (is_email_for_quote($product_info['products_price'])) { $products_price = show_email_for_quote($product_info); } elseif (($new_price = tep_get_products_special_price($product_info['products_id'])) && is_email_for_quote($product_info['specials_new_products_price'])) { $specials_price =show_email_for_quote($product_info['specials_new_products_price']); } else { $add_to_cart = tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fas fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-block btn-lg btn-product-info btn-buy') . tep_draw_hidden_field('products_id', (int)$product_info['products_id']); } And then later, replace the add to cart code with if ($add_to_cart) { echo $add_to_cart; } Always back up before making changes. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.