Support Forums

link payment product price to item price

This is a discussion on link payment product price to item price within the Technical Support forums, part of the Technical Support Forums category; I want to link the payment product price to the price of the item being advertised. I have 2 payment ...


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

Reply
 
Thread Tools Display Modes
Old 11-10-2010, 05:02 PM   #1
jw4
Junior Member
 
Join Date: Jun 2010
Posts: 13
Rep Power: 3
jw4 is on a distinguished road
Default link payment product price to item price

I want to link the payment product price to the price of the item being advertised.

I have 2 payment products:
item under �10 - free (product id '1')
item over �10 is 10% item value to max �5.00. (product id '16')

In includes/core/checkout/step3submit I have amended the code to be conditional update of oSubTotal as follows (added code in red, existing in blue) under the create order section (at line 134)

// adding condition statement to set ad price to % of total price for general item ads JM 10.11.10
if ($orderdata['oProductID']='16')
{
if ($data['price']>='50') {
$orderdata['oSubTotal']='5';
}
else
{
$orderdata['oSubTotal']=$data['price']/10;
}
}
else
{

$orderdata['oSubTotal']=$subTotal;
}
//end of added code


What is happening though is that if free ad package selected (productid 1), price at Listing preview is calculated as for productid 2.

Somehow the field I am checking 'oProductID' gets set to '16' no matter which payment product selected.

I have checked in debug as follows (where product id is 1 - i.e. free ad):

Listing details: $productid=1

Add Images: $pID=1

Step 5: Verify detaisl - $productid-1 BUT $oProductID=16 (where does this come from?)

Listing Preview: both $productid and $oProductId now = 16

PLEASE can anyone tell me what I am doing wrong? I don't understand why my if statement is not working on the product id and why the product id values are changing in the later scripts.

Any help gratefully received!
jw4 is offline   Reply With Quote
Old 11-10-2010, 08:44 PM   #2
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,053
Rep Power: 61
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

I don't know how that is happening, however one thing I would recommend to you is NOT use the variable $orderdata['oProductID']

Everything throughout the checkout process regarding the product is by the variable $productid, which includes assigning $orderdata['oProductID'] = $productid which is right above where I am assuming you put the code that you posted. The $orderdata array is used only to update the order in the db and nowhere else.

Try basing your logic on the variable $productid instead
PHP Code:
if ( $productid 16 
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 11-11-2010, 05:20 AM   #3
jw4
Junior Member
 
Join Date: Jun 2010
Posts: 13
Rep Power: 3
jw4 is on a distinguished road
Default

HI thanks very much for response.

I have tried using $productid instead, but it doesn't work. Even though in debug mode I can see $productid is available, when hitting continue after entering listing details I get the following error message:

Warning: Smarty error: unable to read resource: "" in /home/corpora7/public_html/our-stuff.org/includes/classes/smarty/Smarty.class.php on line 1092.

Could you tell me what I am doing wrong?

Here is the amended code

// adding condition statement to set ad price to % of total price for general item ads JM 10.11.10
if ($productid=16)
{
if ($data['price']>='50')
{
$orderdata['oSubTotal']='5';
}
else
{
$orderdata['oSubTotal']=$data['price']/10;
}
}
else
{
$orderdata['oSubTotal']=$subTotal;
}
//end of added code


Many thanks again for any help.

Last edited by jw4; 11-11-2010 at 05:22 AM. Reason: error in explanation
jw4 is offline   Reply With Quote
Old 11-11-2010, 10:18 AM   #4
jw4
Junior Member
 
Join Date: Jun 2010
Posts: 13
Rep Power: 3
jw4 is on a distinguished road
Smile Problem resolved

Just to let you know, my problem resolved using $productid (for id value '1').

I don't know what the problem was - maybe some data corruption. I deleted and re-added the payment products and deleted all history from my browsers.

I know have a payment product where the Ad price relates to the cost of the item being sold, to a maximum value of �5.00 - condition coded as:

//adding condition statement to set ad price to % of total price for general item ads JM 10.11.10

if ($productid=1)
{

if ($data['price']>='50')
{
$orderdata['oSubTotal']='5';
}

if ($data['price']>'10' && $data['price']<'50')
{
$orderdata['oSubTotal']=$data['price']/10;
}
}
//end of added code


thanks again for help, this is a great forum
jw4 is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Price Required...Price Displayed tdisraeli Technical Support 6 12-02-2008 05:57 PM
Price??? tdisraeli Technical Support 1 09-30-2008 03:54 AM
Remove Price and Need View Profile Link dexignz Technical Support 0 06-29-2008 09:55 AM
Hide price field when price=0 canariasdata Technical Support 3 06-11-2008 03:30 PM


All times are GMT -4. The time now is 10:45 AM.


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