Question

on my site, If you go to New Products http://www.lutari.net//products.php?new&sid=ea6d72cb65007bb0474d3ec708832882 You can see you can only add some items to the cart (the ones you cant add are not in stock) So Im happy with this.

But then if you go to a catergory like this one http://www.lutari.net//index.php?cPath=13&sid=ea6d72cb65007bb0474d3ec708832882 (None of this is in stock) You can then just click Buy now.

I want to disable the BUY NOW button.

Does anyone know how I do this?

(I used a patch to do the Add to cart button)

Products_listing.php (ive scanned the code for anything with the word "buy"

 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                   'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

and

     case 'PRODUCT_LIST_BUY_NOW':
              $lc_text = $osC_Language->get('listing_buy_now_heading');

Also

case 'PRODUCT_LIST_BUY_NOW':
            $lc_align = 'center';
            if ($Qlisting->value('products_type') == PRODUCT_TYPE_SIMPLE) {
              $lc_text = osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $Qlisting->value('products_id') . '&' . osc_get_all_get_params(array('action')) . '&action=cart_add'), osc_draw_image_button('button_buy_now.gif', $osC_Language->get('button_buy_now'), 'class="ajaxAddToCart" id="ac_productlisting_'. $Qlisting->value('products_id') . '"')) . '&nbsp;<br />';
            }else {
              $lc_text = osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $Qlisting->value('products_id') . '&' . osc_get_all_get_params(array('action')) . '&action=cart_add'), osc_draw_image_button('button_buy_now.gif', $osC_Language->get('button_buy_now'))) . '&nbsp;<br />';
            }

Would this be it? or am I needing to look at a different page?

Right...

So In Product_listing.php I have changed

$lc_text = osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $Qlisting->value('products_id') . '&' . osc_get_all_get_params(array('action')) . '&action=cart_add'), osc_draw_image_button('button_buy_now.gif', $osC_Language->get('button_buy_now'))) . '&nbsp;<br />';

to

$lc_text = osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $Qlisting->value('products_id') . '&' . osc_get_all_get_params(array('action')) . '&action=cart_add'), osc_draw_image_button('button_add_to_cart.png',  $osC_Language->get('button_add_to_cart'))) . '&nbsp;<br />';

Now, in new.php there is a patch to make the add to cart button disable if he product is out of stock. Which is this code

 if($osC_Product->getQuantity() > 0) {
            echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id') . '&action=cart_add'), osc_draw_image_button('button_in_cart.gif', $osC_Language->get('button_add_to_cart'), 'class="ajaxAddToCart" id="ac_productsnew_' . $Qproducts->value('products_id') . '"'));
                        } else { 
                        //echo '<span><font color="#990000" size="2">Out of stock</font></span>';
                        echo osc_draw_image_disabled_button('button_in_cart_disabled.gif', 'No Stock', 'id="ac_no_product"');
                        }
          ?>

So i tried putting this into products_listing.php and It worked.. But the buttons appear at the top of page, not next to the items..

Anyone have any ideas what to do next?

Was it helpful?

Solution

Do you have your codes? Maybe if I can see it I should be able to help. But generally, you can try doing this.

if quantity != 0
{
    print buy now button
}

Let me know if this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top