Page 1 of 1

Cart Module - How do I display user defined fields?

Posted: Fri Oct 02, 2009 6:59 am
by SideshowBob
Hi All,

I am using the Calguy E-commerce modules (versions below) and I have defined a few text fields in product manager. I am now trying to display one of those fields (product_code) in the Viewcart template.

Cart = 1.4.2 | Orders = 1.5.3 | Products = 2.4.3

I can usually manipulate templates without a problem but this one has me stumped.

My viewcart template looks like this:

Code: Select all

<pre>
{$cartitems|print_r}
</pre>

{foreach from=$cartitems item='oneitem'}
    Product Code = {$oneitem->flds->product_code->value} <br />    {* ****** This line doesn't work ********** *}
{/foreach}
and the output is:

Code: Select all

stdClass Object
(
    [product_id] => 183
    [quantity] => 1
    [attributes] => Array
        (
        )
    [weight] => 1
    [base_price] => 40.56
    [unit_price] => 40.56
    [summary] => Car Key Ring Torch (CDU) 
    [file_location] => http://192.168.11.3/ecotronic/uploads/Products/product_183
    [flds] => Array
        (
            [large_image] => stdClass Object
 *RECURSION*
            [product_code] => stdClass Object
 *RECURSION*
            [dimensions] => stdClass Object
 *RECURSION*
            [pack_size] => stdClass Object
 *RECURSION*
        )
    [categories] => Array
        (
        )

    [quantity_box] => 
)
Array

Product Code = 
I understand the basic idea of recursion but I don't know how to access the 'product_code' values so clearly I don't understand it that well!

Can anyone help me out?

Thanks,
Bob

Re: Cart Module - How do I display user defined fields?

Posted: Sun Oct 04, 2009 5:27 pm
by SideshowBob
Sorry for the bump but any ideas anyone?

Re: Cart Module - How do I display user defined fields?

Posted: Fri Oct 09, 2009 5:57 am
by SideshowBob
Well in the end I hacked the php code to give me what I needed but obviously not an ideal solution :-(

If anyone has any ideas then let me know.

Re: Cart Module - How do I display user defined fields?

Posted: Mon Nov 02, 2009 9:45 pm
by hhm
Hey man,

Could you share the solution (even though it might be nasty)?
I'm in the same situation as you and cannot crack this one..

Best regards,
Henrik

Re: Cart Module - How do I display user defined fields?

Posted: Tue Nov 03, 2009 7:43 am
by Somebody_1
This is not the best solution but it works.

Create a product template with the field your trying to access eg.

Template Name: thumbnail
Content: {$entry->file_location}/{$entry->fields.Image->thumbnail}

Then add the following to your cart tempalate.

{Products action='details' detailtemplate='thumbnail' productid=$oneitem->product_id}.

Re: Cart Module - How do I display user defined fields?

Posted: Tue Nov 03, 2009 9:39 am
by hhm
Thx guys, will try it out later today.

Cheers,

/Henrik