Jump to content
Sign in to follow this  
Guest OMAR TORRES

Attribute type list shows incorrect value

Recommended Posts

Guest OMAR TORRES

I created an attribute type "List" which shows the values ​​you can have the field "number of persons" should go from 1 to 16.

 

At first I was shown, after getting down to work on editing the property sheet, I tell them what the problem.

Now the problem is that in the Web tab of the property showed that value from 1 through 16 are the numbers of people as possible in the houses there is a relation with attributes ID No. 1 to No. 16.

 

I give you an example:

 

http://www.villastorentibiza.com/ibiza-villas-reservations/To-Rent/8-villas-ibiza-rent-villa

number of persons show: "san antonio" which is the attribute ID 16

should show the value: 16

displays the name of "san antonio" because it is the number 16 of my attributes.

 

Another example:

 

http://www.villastorentibiza.com/ibiza-villas-reservations/To-Rent/4-Casa-Calma

number of persons show: "District"

should show value: 14

shows "District" that the list of people, I have selected 14 people but shows the ID 14 is District.

Share this post


Link to post
Share on other sites
Guest Steve Bentley

So you created a list attribute with values 1 to 16. Are you saying you inserted it into the page with code?

if yes then you dont need to

Share this post


Link to post
Share on other sites
Guest OMAR TORRES

What I mean is that it is an attribute that I created in the component which lets you customize attributes jom_estate for houses.

 

I have not anything I inserted the html or php web, ie it is an attribute I can be more like BBQ, swimming pool access, but such list. So does not show the numerical value but the value of the attribute with the same ID.

 

Therefore obtain, instead of, num. of persons: 14, I get the following result num of persons: district (For the ID 14 of the variable attributes the District)

Share this post


Link to post
Share on other sites
Guest Steve Bentley

In _detailed.tpl.php

can you post the section starting with

{*ATRIBUTTES*}

 

and ends with

 

{/foreach}

Share this post


Link to post
Share on other sites
Guest OMAR TORRES

In the details section of the property and I did it because it does not solve the problem was, you just leave here the code.

{*ATRIBUTTES*} {foreach from=$setall item=item} {if $item.attr_value}

{$item.name} {$item.attr_value|JView:$item.attr_id:$data->id:$item.type:$item.req_type:$item.stype}

{/if} {/foreach}

It happens that I can not display the value contained in home_details_m, as you explained in another post. But other variables if I can, but with this I keep going the same problem showing ID and not the value. But only in the jomestate module on the homepage.

{capture name=numpersonas}{JViewAttrValue addID=$item->id attrID=66}{/capture}  {$smarty.capture.numpersonas} people  

Thanks Steve, always help.

Share this post


Link to post
Share on other sites
Guest Steve Bentley

HiI think I understand but things may be lost in translation.The atribute you have made will show there by default correctly. So im guessing its not working so you are trying to correct it by inserting the attribute using the capture name code. I hope I have not misunderstood.You have something messed up in your code as mine is standard?This is my code

{*ATRIBUTTES*} {foreach from=$setall item=item} {if $item.attr_value}

{$item.name} {$item.attr_value|JView:$item.attr_id:$data->id:$item.type:$item.req_type}

{/if} {/foreach}

Do you see the differance? I think you have draged it by mistake and mixed it up If you replace your code with mine it should work (backup first)Then you wont need to insert the atribute bu handSteve

Share this post


Link to post
Share on other sites
Guest OMAR TORRES

You were right, thank you very much I had not seen the error.

 

But I still have problems, now this attribute to display as itento capture to show the value in the "home_details_m" as you explained in another post on the forum.

 

So far not had problems to capture and display attribute, because none was type list of values, but a specific value.

 

And could not display the value.

 

I also still going to the houses that already had previous mind, I show the same failure as before and the new properties but does not happen.

 

I enclose two sacks as I explained badly.

 

CODE in modules/jomestate/tmpl/default.php

 

 

{capture name=numpersonas}{JViewAttrValue addID=$item->id attrID=66}{/capture}

 {$smarty.capture.numpersonas} people  

 

 

But this code does not show the value of the attribute, as in detailed.tpl.php, a value of 1 to 16.

Or does not show anything, or show the problem I had in the detailed.tpl.php that now I have.

post-2946-13904241670521_thumb.jpg

post-2946-13904241670756_thumb.jpg

post-2946-13904241670997_thumb.jpg

Share this post


Link to post
Share on other sites
Guest Steve Bentley

thats good news, we are on the way to sucess :-)

 

Some words did not translate but I think I understand

 

If you use the code in list.tpl.php you dont need the

or the ;

So just add this to the end of the existing like this all in one line no return

{capture name=numpersonas}{JViewAttrValue addID=$item->id attrID=66}{/capture}{$smarty.capture.numpersonas}

 

If the value does not always exist you need to display only if it has a value.

I pinched this code from further up in the list.tpl.php so it should work, but i have not tested it

 

{if $smarty.capture.numpersonas != 0}{$smarty.capture.numpersonas} people{/if}

 

So maybe this in total

 

{capture name=numpersonas}{JViewAttrValue addID=$item->id attrID=66}{/capture} {if $smarty.capture.numpersonas != 0} {$smarty.capture.numpersonas} people{/if} 

 

Keep in mind I am not a programmer so if anyone wants to jump in please do.

 

Give it a try

Cheers

Steve

Share this post


Link to post
Share on other sites
Guest OMAR TORRES

Hi Steve, the problem is not the syntax of the code.

 

The problem is, the return value does not correspond to the value of that variable and do not know why.

 

You can see how the attribute "num. Of persons" in the tab of the home returns the value 14 is right.

Example: http://www.villastorentibiza.com/ibiza-villas-reservations/To-Rent/4-Casa-Calma

 

However, when captured to show the value "14", with the code I had, although estubiera empty attribute value it showed, however, did not show the value "14" but another, which corresponded to the name of another attribute .

 

My question is, to get the real value of this attribute must be done differently because it is a list of values ​​and not a variable stored?

 

With other attributes I have no problem, because they are such "input", but this attribute is type "select" as I can get the value of select?

 

Thank you for interest.

Share this post


Link to post
Share on other sites
Guest Steve Bentley

Hi Omar

So you are trying to show num. of Persons in the list view?

and it shows ok in the detailed view?

 

what I was saying earler, if I understand was the code was not correct for the list view. If there is a minor fault it will show nothing, not always an error.

Can you post the section of code you are having problems with?

Cheers

Steve

Share this post


Link to post
Share on other sites
Guest Steve Bentley

oh just occured to me. Where are you putting the code? in which file is it?

 

I have a select attribute called number of bedrooms that i display in list view with no problems

Share this post


Link to post
Share on other sites
Guest OMAR TORRES

I attached the file that is in modules / mod_jomestate / tmpl / default.phpPD: I CAN'T ATTACHED TXT SERVER CAN'T MOVE TO PUBLIC FILES SAYS.I used also showed an attribute called number of rooms, but this is kind input, so there was no problem, ok captured and displayed, the problem is with such list.I'm glad I explained the problem correctly at the end ^ ^This is modules / mod_jomestate / tmpl / default.php

<?php // no direct accessdefined('_JEXEC') or die('Restricted access'); ?>

{foreach from=$data item=item} {if $params->get(pos) == 1}
{else}
{/if}

{capture name=district}{JViewAttrValue addID=$item->id attrID=14}{/capture}{$smarty.capture.district}

{if $item->mfile} {if $item->mpublished == 1} {else}
{/if} {else}
no_photo.jpg
{/if}
{if $params2->get(ad_price)} {if $item->price_visible} {if $params->get('currency_position')} {$item->ad_price|priceseparator} {$item->currency_id|jcurrency} {else} {$item->currency_id|jcurrency} {$item->ad_price|priceseparator} {/if} {/if} {/if} {if $item->ad_price_option} / {$item->ad_price_option|price_option} {/if}
{capture name=numpersonas}{JViewAttrValue addID=$item->id attrID=66}{/capture} {if $smarty.capture.numpersonas != 0}  {$smarty.capture.numpersonas} people  {/if}

id}&category={$item->type|jcat}&ad_headline={$item->ad_headline}"}'" />

id}&category={$item->type|jcat}&ad_headline={$item->ad_headline}"}" style="text-decoration: none;">{$item->ad_address} {if $params->get('currency_position')} {$item->ad_price|priceseparator} {$item->currency_id|jcurrency} {else} {$item->currency_id|jcurrency} {$item->ad_price|priceseparator} {/if} {if $item->ad_price_option} / {$item->ad_price_option|price_option} {/if}
{if $smarty.capture.numofbed != 0}{$smarty.capture.numofbed} {JText text='JE_HOMEPAGE_BED'}    {/if} {if $smarty.capture.numofbath != 0}{$smarty.capture.numofbath} {JText text='JE_HOMEPAGE_BATH'}    {/if} {if $smarty.capture.housesize != 0}{$smarty.capture.housesize} {$params->get(metric_units)}    {/if}
{$item->ad_description|truncate:50}

id}&category={$item->type|jcat}&ad_headline={$item->ad_headline}"}'" class="jombutton" />

{/foreach}

 

Share this post


Link to post
Share on other sites
Guest Steve Bentley

What I mean is in the attribute configuration in the Validation Type section is it set to numbers only or something else?

Share this post


Link to post
Share on other sites
Guest Steve Bentley

if you not sure try replace the 0 with "". Not sure if "" will represent a blank text attribute but it should at least display, any a blank attribute can then be tested.

 

{capture name=numpersonas}{JViewAttrValue addID=$item->id attrID=66}{/capture}

{if $smarty.capture.numpersonas != ""}  {$smarty.capture.numpersonas} people  {/if}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×