Cart Module - How do I display user defined fields?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

Cart Module - How do I display user defined fields?

Post 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
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

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

Post by SideshowBob »

Sorry for the bump but any ideas anyone?
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

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

Post 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.
hhm
Forum Members
Forum Members
Posts: 40
Joined: Tue Dec 27, 2005 4:28 pm

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

Post 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
Somebody_1
Forum Members
Forum Members
Posts: 26
Joined: Tue Oct 20, 2009 10:52 am

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

Post 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}.
hhm
Forum Members
Forum Members
Posts: 40
Joined: Tue Dec 27, 2005 4:28 pm

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

Post by hhm »

Thx guys, will try it out later today.

Cheers,

/Henrik
Post Reply

Return to “Modules/Add-Ons”