Support Forums

Old 12-30-2007, 01:14 PM   #1
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 7
Angelus077 is on a distinguished road
Default maximum price setting

Is it possible to set the price for an add to a maximum.

I have a site where users can place an add but the price they ask for the object can not exceed 1000 Euro's.

If this is possible where can i change it?
Angelus077 is offline   Reply With Quote
Old 12-30-2007, 01:47 PM   #2
Coder
 
Join Date: Mar 2006
Posts: 4,564
Rep Power: 111
Lhotch is just really niceLhotch is just really nice
Default

There is no option to set the maximum price. You would likely have to use modify the checkout template and apply some logic to the field and if its > 1000 set the value to 1000.
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 01-05-2008, 01:58 PM   #3
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 7
nachtwerkmir is on a distinguished road
Default but how

can you be more specific? I would like to set a maximum price too. What code and where? (i'm still learning php)
nachtwerkmir is offline   Reply With Quote
Old 01-05-2008, 04:29 PM   #4
Coder
 
Join Date: Mar 2006
Posts: 4,564
Rep Power: 111
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by nachtwerkmir View Post
can you be more specific? I would like to set a maximum price too. What code and where? (i'm still learning php)
Cant be more specific without knowing what version your using, if its developer or designer and what template your using.
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 01-05-2008, 10:05 PM   #5
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 7
Angelus077 is on a distinguished road
Default

I am using the developer edition with the default template. V3.1
Angelus077 is offline   Reply With Quote
Old 01-06-2008, 10:48 AM   #6
Coder
 
Join Date: Mar 2006
Posts: 4,564
Rep Power: 111
Lhotch is just really niceLhotch is just really nice
Thumbs up

This can be done at the script level or the template level. For ease I would probably recommend doing it at the template level and what you would do, in a nutshell, is let the ad poster enter any dollar amount they like which gets stored in the database BUT when the ad is displayed to the public, the template chekcs the value entered for the price. If its more than your sites guidelines allow then simply display the max allowable price.

To do this you will need to make note of each template where your site is displaying a price. I cant tell you exactly where because this can be changed in admin not only for the pages but the user level that can see the price as well.

You can see the script in use by appending "debug=1" to the URL when you are viewing a page on your site and this will cause a popup window which will contain caraible details including the template being shown.

Then, as an example of how to incorporate logic to check for the pice. Open your viewlisting.tpl.php template and look for the section that displays the price, should looks something like this....

Code:
{if $viewprice=="Y"}
	<tr> 
		<td><strong>{$smarty.const.LANG_PRICE}:</strong></td>
		<td>{$listingprice}</td>
	</tr>
{/if}
{$listingprice}is a variable that holds the value of the item being sold but if you look at the debug window it also has a currency symbol so to do a numeric evaluation we need to make sure it evaluates the number without the currency symbol.

To do that we can use the smarty function REPLACE

example below replaces the dollar sign in the value with nothing so in essence removes it which gives us a numeric value we can use to evaluate.

{$listingprice|replace:'$':''}

Next we need to create logic to evaluate the price against our desired max value so we can use some logic like this.....

Code:
{if $viewprice=="Y"}
	<tr> 
		<td><strong>{$smarty.const.LANG_PRICE}:</strong></td>
                     {if $listingprice|replace:'$':'' > "1000"}
                          <td>$1000</td>
                     {else}
                          <td>{$listingprice}</td>
                     {/if}
	</tr>
{/if}
basically it says if the listing price (with the dollar sign removed) is greater than 1000 (or what ever your desired max price is) then display what your desired max price is otherwise just display the price stored in the database.

This will be the way is has to be done for the designer version since you dont have access to the code if you own that version.

To make changes to the scripts your going to have to modify the usercheckout.php and membercheckout as well as the modify ad scripts. In usercheckout.php if you look at step four you will see this section where it collects post data from the html form.

PHP Code:
if(isset($_POST['price']) && $_POST['price']<>"")
{
    
$listingprice=@trim($_POST['price']);

You simply need to add logic to check for the value entered and if its too large assign it your max allowed price, something like this.....

PHP Code:
if(isset($_POST['price']) && $_POST['price']<>"")
{
        if(
$_POST['price']>"1000")
        {
             
$listingprice="1000";
        }else{
         
$listingprice=@trim($_POST['price']);
        }

if listing price is greater than 1000 then it now is 1000 and thats whats stored in the database and if its not greater than 1000 use the price as entered by client.
__________________
Larry.
Lhotch is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MOD: Price Descriptor Chaslie v3.1 Modules & Modifications 7 02-27-2008 03:23 PM
Price checking by Listing Package Bucketman v3.0 Questions & Support 25 12-03-2007 04:48 AM
How can i remove the price fields? comcoach v3.1 Questions & Support 6 10-03-2007 09:50 AM
Removing Price entirely Metacraft v3.1 Questions & Support 4 07-24-2007 12:47 PM
Not show price garysmith v3.1 Modules & Modifications 10 05-30-2006 05:44 AM


All times are GMT -4. The time now is 11:07 PM.


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