X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   How to add extra field values to the product list page (https://forum.x-cart.com/showthread.php?t=73638)

cherie 03-29-2016 01:31 PM

Re: How to add extra field values to the product list page
 
print_r should be available if you enable DEVELOPMENT_MODE in config.php. Or you should be able to use debug_print_var.

In subcategories.tpl $cat_products gets assigned to $products when calling products.tpl.

Before your new code (or comment it out) in products.php, after includes/search.php (which gets the products and extra_fields), try adding something like this:

PHP Code:

echo'<!-- ';print_r($products);echo'-->'

Then look at the page source to see the products array. I'm curious to know if your array has an [extra_fields] section.

Dumb question: are you looking at a set of products that have assigned extra_field values in the admin?

I don't believe that SO link applies.

I believe Rob's solution was to get extra_fields that weren't known to already exist. This is a common oversight.

One thing I noticed is that as of 4.7.4 there is a new variable ($obtain_extra_fields) in include/search.php but I don't see it referenced anywhere else and has not stopped me from getting extra_fields normally (though it appears it should).

DrQuietus 03-29-2016 01:39 PM

Re: How to add extra field values to the product list page
 
There is no [extra_fields] section.

Code:

)

    [2] => Array
        (
            [productid] => 25
            [productcode] => 01PB03041R
            [provider] => 1
            [distribution] =>
            [weight] => 0.00
            [net_weight] => 0.00[list_price] => 0.00
            [avail] => 0
            [rating] => 0
            [forsale] => Y
            [add_date] => 1459014062
            [shipping_freight] => 0.00
            [free_shipping] => N
            [discount_avail] => Y
            [min_amount] => 1
            [length] => 0.00
            [width] => 0.00
            [height] => 0.00
            [low_avail_limit] => 10
            [free_tax] => N
            [product_type] => N
            [manufacturerid] => 0
            [return_time] => 0
            [meta_description] =>
            [meta_keywords] =>
            [small_item] => N
            [separate_box] => N
            [items_per_box] => 1
            [title_tag] =>
            [taxcloud_tic] => 00000
            [avatax_tax_code] =>
            [is_variants] =>
            [is_product_options] =>
            [is_taxes] =>
            [variantid] => 0
            [price] => 3.67
            [product] => 01 Light Duty Rigid Plate
            [descr] => 01 Light Duty Rigid Plate
            [fulldescr] => 01 Light Duty Rigid Plate
            [taxed_price] => 3.67
            [is_image_T] => 1
            [tmbn_url] => FAKEURL.com/images/T/LD_01Series_300-T-22.jpg
            [image_x] => 150
            [image_y] => 150
            [tmbn_x] => 150
            [tmbn_y] => 150
            [appearance] => Array
                (
                    [empty_stock] =>
                    [has_price] => 1
                    [has_market_price] =>
                    [buy_now_enabled] =>
                    [buy_now_form_enabled] => 1
                    [min_quantity] => 1
                    [max_quantity] => 50
                    [buy_now_buttons_enabled] => 1
                    [force_1_amount] =>
                    [added_to_cart] =>
                    [quantity_input_box_enabled] =>
                    [is_auction] =>
                    [buy_now_cart_enabled] => 1
                    [loop_quantity] => 51
                    [buy_now_add2wl_enabled] =>
                )

            [page_url] => product.php?productid=25&cat=22&page=1
        )

    [3] => Array


I double checked, there are extra fields, the module is turned on and the values are showing on the customer product page.

cherie 03-29-2016 01:45 PM

Re: How to add extra field values to the product list page
 
I did some testing and my hunch about the new $obtain_extra_fields variable is correct. Before the include/search.php line add the following:

PHP Code:

$obtain_extra_fields 1


cflsystems 03-29-2016 03:07 PM

Re: How to add extra field values to the product list page
 
https://forum.x-cart.com/showthread.php?t=73783


All times are GMT -8. The time now is 11:34 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.