显示我们 Zencart 商店中所有库存产品的“库存”图像

问题描述 投票:0回答:1

尝试获取“有货”图像以显示我们 Zencart 商店目前有货的所有产品。

默认情况下,商店仅在缺货时显示产品的“缺货”图像。

我们试图调整以适应“库存”图像状态的代码如下:

$lc_button = '';
            if (zen_requires_attribute_selection($record['products_id']) || PRODUCT_LIST_PRICE_BUY_NOW == '0') {
                // more info in place of buy now
                $lc_button = $more_info_button;
            } else {
                if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
                    if (
                        // not a hide qty box product
                        $record['products_qty_box_status'] != 0 &&
                        // product type can be added to cart
                        zen_get_products_allow_add_to_cart($record['products_id']) != 'N'
                        &&
                        // product is not call for price
                        $record['product_is_call'] == 0
                        &&
                        // product is in stock or customers may add it to cart anyway
                        ($listing_quantity > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0)
                    ) {
                        $how_many++;
                    }

任何关于添加一些代码以显示“库存”图像的建议或帮助,将不胜感激!

php image status
1个回答
-1
投票
$lc_button = '';
if (zen_requires_attribute_selection($record['products_id']) || PRODUCT_LIST_PRICE_BUY_NOW == '0') {
    // more info in place of buy now
    $lc_button = $more_info_button;
} else {
    if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
        if (
            // not a hide qty box product
            $record['products_qty_box_status'] != 0 &&
            // product type can be added to cart
            zen_get_products_allow_add_to_cart($record['products_id']) != 'N'
            &&
            // product is not call for price
            $record['product_is_call'] == 0
            &&
            // product is in stock
            $record['products_quantity'] > 0
        ) {
            $how_many++;
            // Display "In Stock" image
            $lc_button = '<img src="path/to/in_stock_image.png">';
        } elseif (
            // product can be backordered or customers may add it to cart anyway
            SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0
        ) {
            // Display "Out of Stock" image
            $lc_button = '<img src="path/to/out_of_stock_image.png">';
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.