newb question in php

Status
Not open for further replies.

chrislingle

Banned
Jul 18, 2006
2,544
52
0
I am brand new to php and trying to modify a free php store that i found because it does just what I want, left column shows categories, center column shows individual products. there is a add to cart button that I want to customize to go to the affiliate url. this is the url of were i am at so far (http://online-fit-club.com/teststore/plaincart/index.php?c=12&p=3)

so I need to modify the template to show images from a url and change the buy button to send to my aff url.
the whole sorce code is here (http://www.phpwebcommerce.com/) can someone who knows how to do this help and then we can post the whole thing maybe in the newby section to help others.
I would really appreciate any help!
 


I haven't looked at the DB scheme, but you will probably need to find somewhere to insert your affiliate url. Adding a column for your affiliate url in the products table, then updating http://www.phpwebcommerce.com/source/include/productDetail.php and http://www.phpwebcommerce.com/source/admin/product/add.php to have code that lets you add the affiliate url

You will then need to change the template page on http://www.phpwebcommerce.com/shop-view-product-detail.php
to output your affiliate url

 
OK db is at http://www.phpwebcommerce.com/shopping-cart-database-design.php

In table "tbl_product", add a varchar(255) pd_affurl

In http://www.phpwebcommerce.com/source/admin/product/add.php
add

Code:
<tr>  
   <td width="150" class="label">Affiliate Link</td> 
   <td class="content"> <input name="txtAffUrl" type="text" class="box" id="txtAffUrl" size="50" maxlength="255"></td> 
  </tr>
In http://www.phpwebcommerce.com/source/admin/product/processProduct.php
in function addProduct()
add
[code]
$affurl = $_POST['
txtAffUrl'];
[/code]
Change
Code:
$sql   = "INSERT INTO tbl_product (cat_id, pd_name, pd_description, pd_price, pd_qty, pd_image, pd_thumbnail, pd_date) 
              VALUES ('$catId', '$name', '$description', $price, $qty, '$mainImage', '$thumbnail', NOW())";
to
Code:
$sql   = "INSERT INTO tbl_product (cat_id, pd_name, pd_description, pd_price, pd_qty, pd_image, pd_thumbnail, pd_date, pd_affurl) 
              VALUES ('$catId', '$name', '$description', $price, $qty, '$mainImage', '$thumbnail', NOW(), '$affurl')";

You'll also need to change http://www.phpwebcommerce.com/source/library/product-functions.php
to include pd_affurl in the SQL query, and code so that the code is returned to the http://www.phpwebcommerce.com/source/include/productDetail.php page where you'll change the output code


 
Guy, thanks I have done this and it did not work, what I did was add
`pd_buyurl` text NOT NULL, to the product database but the url is not going into the database. I had thought all I would have to do was add the info in the other files and chage the button but it did not work
 
thanks, the database stuff helped the link is now in the database but the button is not working but I will work on it, thanks
 
Status
Not open for further replies.