to get the products name, color and size. but how can i get only one of them?
[U][B]Solution:[/B][/U]
[QUOTE=KaiNeuwerth;125237]
[{assign var="oSingleProduct" value=$_product->getArticle()}]
<!-- Now you have an oxArticle object saved in $oSingleProduct! $_product is only an oxBasketItem object. -->
[{$oSingleProduct->oxarticles__oxtitle->value}] <!-- this should work now... -->
[/QUOTE]
@KaiNeuwerth : [{$oSingleProduct->oxarticles__oxvarselect->value}] … <-- this gave me the Color/size which is in Variants/selections of the product.
[QUOTE=vanilla thunder;124910]some patience would be nice
edit:it think its enough patience now, here a possible solution:
…
you will need to replace “basketContents” with “miniBasketList” in the code cause that is the name of the foreach loop[/QUOTE]
in the “normal” basket there is an array of basket articles and they are accessed by their index, (at least in the actual version) but i have not checked if it would work in minibasket, too.
[{foreach key=key item=item from=$_product}]
you should not use a foreach loop on a single element, cause it only works with arrays or lists.
try:
in the “normal” basket there is an array of basket articles and they are accessed by their index, (at least in the actual version) but i have not checked if it would work in minibasket, too.
this is how the minibasket.tpl look like: minibasket.tpl - Pastebin.com
I guess we’ve all already did that but in an other way as you like to do.
It’s hard for me to understand what you’d like to reach…
Normally the basket contents are just iterated in a foreach loop. In each loop cycle you have 1 oxArticle-Object (or maybe oxBasketItem, idk) in your variable $item so you can do things like
[{$item->oxarticles__oxtitle->value}] <-- echos the title of a product
[{assign var="oPrice" value=$item->getPrice()}] <-- returns an oxPrice-Object with filled properties
[{assign var="oManufacturer" value=$item->getManufacturer()}] <-- returns an oxManufacturer-Object
and so on… Please make us an understandable example of what you have and what you’d like to have instead!
Allright then try to add the following code over your te[{ … }]st…
[{assign var="oSingleProduct" value=$_product->getArticle()}]
<!-- Now you have an oxArticle object saved in $oSingleProduct! $_product is only an oxBasketItem object. -->
[{$oSingleProduct->oxarticles__oxtitle->value}] <!-- this should work now... -->
That is exacly what i needed
Is there a way to know, what exacly i get retrieve/extract from $oSingleProduct? So i know exacly what things(like oxarticles__oxtitle->value) i can use on it?
I would like to be able to quickly know, how i can get information from each product. Like if i wanted the *Size and color(variant), the Manufacturer, height, Weight,Quantity etc. which you set in the oxid backend. how do you do that fast?
To get the color and size in my example, i probably would have to do some trimming?
inside a template, clear /tmp and then call the site in frontend - it will open a popup with tons of information about what values you can access within the template
inside a template, clear /tmp and then call the site in frontend - it will open a popup with tons of information about what values you can access within the template[/QUOTE]
It didnt get oxarticles__oxtitle etc. when i tryed it.
[QUOTE=KaiNeuwerth;125269]Another solution would be:
[{$oSingleProduct|dumpVar}]
With it you get the most information about the oxArticle object but I don’t know whether it helps you or not :D[/QUOTE]
'oxarticles__oxtitle' =>
oxField::__set_state(array(
'value' => 'T-Shirt med V-hals',
Great but the list doesnt contain “Black”(color and size from the picture above…Black | S)
How do i get to find the information i want in the future? how did you find oxarticles__oxvarselect? i would like to have help on how i can help myself
edit: [{$oSingleProduct->oxarticles__oxvarselect->value}] worked perfectly. thanks OP updated.
[QUOTE=gnomic;125279]But that isnt shown in the dumpVar.[/QUOTE]
Right, because the oxArticle object gets extended to the runtime when fields are needed (uses lazyload).
[QUOTE=gnomic;125279]
How do i get to find the information i want in the future? how did you find oxarticles__oxvarselect?[/QUOTE]
Simple: Because I know it
Let me explain you why it’s called “oxarticles__oxvarselect”…
The first thing you can see here is “oxarticles” (this is the database table oxarticles).
Then comes the seperator “__” which means: Now comes the field I want to access.
In oxarticles there is a field “oxvarselect”.
I hope this helps you to understand how to select fields out of the database.