Support Forums

assigning variables

This is a discussion on assigning variables within the Technical Support forums, part of the Technical Support Forums category; Confused by what appears to be 2 threads in one. Business why not start a new thread. It is now ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 11-01-2009, 08:08 PM   #11
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,731
Rep Power: 42
seymourjames has a spectacular aura about
Default

Confused by what appears to be 2 threads in one. Business why not start a new thread. It is now unclear to me if this thread is about extrafields for cateogries which show on listings or extrafields from the registration process.
__________________
TemplateCodes.com
seymourjames is offline  
Old 11-02-2009, 01:53 AM   #12
Senior Member
 
 
Join Date: Apr 2009
Posts: 274
Rep Power: 8
damiun is on a distinguished road
Default

@seymourjames,

I started this thread because of the extra fields, filled in at checkout, and showed on the viewlisting page.

Quote:
{if $extra3=="Yes"}show paypal image{/if}
this solution doesnt work
__________________
68 Classifieds Dev. 4.1.6 - www.damiun.nl

"The best you can do is to never stop working on what you love to do"
damiun is offline  
Old 11-02-2009, 09:31 AM   #13
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 66
Rep Power: 7
business is on a distinguished road
Default

yeah... there is confusion here.
i assumed this to be extra fields regarding listings... in my first post, I gave a link to a topic started by me on the same subject...
but, another user said this post is about extra fields for users and not listings.... that's why I have posted info regarding extra field in user registration. If the original post was a bit clear on which extra field, it would have been easier.
i haven't found a solution to the listing extra field used in IF statement.
http://www.68classifieds.com/forums/...-variable.html

why don't you use the extra field in user registration form to ask seller if they accept paypal... then, using the code I gave earlier, you can display paypal logo in all listings of the seller...(with this method, you cannot have some listings of the seller with payapl and some without).
__________________
v 4.1.3 Developer
business is offline  
Old 11-02-2009, 03:34 PM   #14
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,731
Rep Power: 42
seymourjames has a spectacular aura about
Default

OK we are now back on the thread. I don't think there is an easy solution.

Setup your extrafield not to display (field not seen in listing). You will notice then it does not display in the end of the checkout process, nor the listing and neither can it be seen on the debug. It is unavailable to you in the normal way. This means that you need to get what is effectively a hidden extrafield in a different way.

{get_extra_field id=$view fid=X}

where you put X in for the id of the extrafield (you can see that number in your admin control panel).

Now I think this should work. Assign it and test it is not null.

{assign var=test value = get_extra_field id=$view fid=X}

{if $test}
put the image here
{/if}
__________________
TemplateCodes.com
seymourjames is offline  
Old 11-03-2009, 09:19 AM   #15
Senior Member
 
 
Join Date: Apr 2009
Posts: 274
Rep Power: 8
damiun is on a distinguished road
Default

@seymourjames

I tested it but it doesnt work,
It shows the text alway, even when the checkbox isnt selected..

Dominick
__________________
68 Classifieds Dev. 4.1.6 - www.damiun.nl

"The best you can do is to never stop working on what you love to do"
damiun is offline  
Old 11-03-2009, 09:47 AM   #16
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,731
Rep Power: 42
seymourjames has a spectacular aura about
Default

Why do you never follow the instructions and try to make it more complex before getting the basics right? checkboxes - who said anything about checkboxes? Next it will be a dropdown multi-level menu choice with inheritance and virtual selections. There is a great book and its all about writing down your requirements. That means details and not throw away 'like to haves'.

I tested this code and spent time on it to check it works . It works for me. It is you that has some other enhanced requirement.

Create a new advert. It is advert dependent because that is what you asked for. Not user dependent or you would then be talking about extrafields in the registration process and we go round in circles on this thread.

Create a simple extrafield - a humble text field. Then if you put text in it, it will pass into the the logical test (print it out). Then refine to try other types of extrafield where there are options. The methodology will be the same.
__________________
TemplateCodes.com
seymourjames is offline  
Old 11-03-2009, 09:07 PM   #17
Senior Member
 
 
Join Date: Apr 2009
Posts: 274
Rep Power: 8
damiun is on a distinguished road
Default

Quote:
checkboxes - who said anything about checkboxes?
You did, this is said by you
Do you mean if extrafield is checked for that advert then it displays on the viewlisting for their advert?

Quote:
Create a new advert. It is advert dependent because that is what you asked for. Not user dependent or you would then be talking about extrafields in the registration process and we go round in circles on this thread.
I said nothing about user depend.........


Quote:
That means details and not throw away 'like to haves'.
I thougt i was pretty clear when i asked: Which file do i have to edit and which code to i have to add?
__________________
68 Classifieds Dev. 4.1.6 - www.damiun.nl

"The best you can do is to never stop working on what you love to do"
damiun is offline  
Old 11-03-2009, 09:27 PM   #18
Coder
 
Join Date: Mar 2006
Posts: 4,711
Rep Power: 115
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by damiun
I thougt i was pretty clear when i asked: Which file do i have to edit and which code to i have to add?
Yeah, the question is very clear, the context however is not and thats why you havent gotten an answer.
__________________
Larry
Lhotch is offline  
Old 11-04-2009, 12:47 AM   #19
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,731
Rep Power: 42
seymourjames has a spectacular aura about
Default

I am not to proud to admit the original code did not work a second time around for me - who knows why.

Try this; it is a better way to go about it anyway. Make a plugin called function.mycheckbox.php with these contents and put it in your plugins folder. It is similar to the get extra fields plugin but it displays the output you want if your checkbox is ticked or does nothing if it isn't. So make your check box for accepting paypal. I only tested this with a single checkbox (ticked or not ticked)

<?php

function smarty_function_mycheckbox($params, &$smarty)
{
global $db,$modules;

$id = '';
$fid = '';
foreach ($params as $_key=>$_value)
{
switch ($_key)
{
case 'id':
case 'fid':
$$_key = (int)$_value;
break;
}
}
if($fid >0)
{
$sSQL = "SELECT fName FROM ".PREFIX."fields WHERE fID='".$fid."'";
$result=$db->query($sSQL);
if($result->isError())
{
return false;
}
if($result->size()>0)
{
$rs=$result->fetch();
}
}

if($id > 0)
{
$sSQL = "SELECT sValue FROM ".PREFIX."products_fields WHERE pID='".$id."' AND fID=".$fid;
$result=$db->query($sSQL);
if($result->isError())
{
return false;
}

if($result->size()>0)
{
$rs=$result->fetch();
$rs['sValue']=str_replace(" | ", ", ", $rs['sValue']);
$check=str_replace("|", "", $rs['sValue']);
}
}

if($check != NULL)
{
?>
<img src="http://www.yourdomain.com/photos/paypal.jpg">
<?php
}
}


Then in your viewlisting.tpl file put it like this {mycheckbox id=$view fid=X} . If the checkbox was ticked then it will output the image.
__________________
TemplateCodes.com
seymourjames is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deprecated: Assigning the return value of new by reference is deprecated in step6.php Peter Technical Support 3 09-11-2009 04:53 AM
Variables seymourjames Technical Support 5 07-17-2008 09:53 AM
Module Variables Maffo v3.1 Questions & Support 18 01-22-2007 09:40 PM
Variables HotAir v3.1 Questions & Support 3 01-08-2007 09:45 AM
Looking for list of variables. BigOrange Templates, HTML, CSS, and Design Help 7 10-06-2006 03:55 PM


All times are GMT -4. The time now is 01:07 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0