Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need to make some adjustments to file


jewelrytrends

Recommended Posts

Posted

Hi,

 

I installed a contrib to make an kelkoo (similar to froogle, only for europe) text file.

 

It looks great but I have to make small adjustments to be able to use it for my site

 

This is the File, the problems I have with it, is that the following:

 

The language in the file can be selected, howeveer the links and the value currency in the text file, show up in english and in dollar.

 

I tried to look if I could make the adjustments myself, but even after all these months I'm pretty bad with the php language code :blush: .

Can somebody help me to adjust this file so that I can select the currency, and the produkt link points to the dutch product info.

 

 

<?php

/*

 

***********************************************************************

 

osCommerce Kelkoo upload list

 

2004/04/08

 

Zlack

[email protected]

 

www.muntenrijk.nl

 

***********************************************************************

 

Plaats kelkoo.php in een map van je catalog b.v. /kelkoo/

Vraag kelkoo op je browser: http://www.je_site.nl/kelkoo/kelkoo.php

Je moet nu al je artikelen zien maar doe hier niets mee !!

Ga in je browser nu naar beeld en klik op bron.

Sla deze gegevens op en geef het een passende naam.

Ga nu naar de site van Kelkoo en voer de instructies uit en upload het tekstbestand van u.

 

Lukt het niet? Mail ons [email protected]

 

 

 

***********************************************************************

 

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License.

 

***********************************************************************

 

*/

echo "#country=nl\n#type=basic\n#currency=EUR\nurl\ttitle\tdescription\tprice\tofferid\timage\n";

// 1. Configure DB Connection

 

$db_server = "xxxxxxxxxxxxxx"; //database server

$db_user = "xxxxxxxx"; //database user

$db_pass = "xxxxxxxxx"; //database password

$db_name = "xxxxxxxxxxx"; //database name

 

// 2. Configure Site Info

//Enter the url to your website

//don't use any slashes or http eg: www.mysite.com

 

$domain_name = "xxxxxxxxxxxxxxxxx";

 

//Enter the directory name of your catalog

//don't use any slashes eg: catalog

 

$catalog_folder_name = " "; //no slashes

 

// 3. Configure XML Data to be included

 

// 3A: Include product prices? (1 is on, 0 is off)

 

$product_price = "1";

 

// 3B: include link to product_info.php at your website? (1 is on, 0 is off)

 

$product_info_link = "1";

 

// 3C: Choose language ! number ! empty is first in db.

 

$language = "4";

 

// 3D: Add tax to product price (1 = Yes 0 = No).

 

$tax_price = "0";

 

// 3E: Add tax to special price (1 = Yes 0 = No).

 

$tax_special = "0";

 

// END CONFIGURATION

 

////////////////////////////////////////////

// create connection

 

$connection = mysql_connect("$db_server","$db_user","$db_pass") or die("Couldn't make connection.");

 

// select database

 

$db = mysql_select_db("$db_name", $connection) or die("Couldn't select database.");

 

// create SQL statement

 

$sqlcount = "SELECT * FROM `products` WHERE `products_status` = 1 ";

 

$sql = "SELECT * FROM `products` WHERE `products_status` = 1";

 

// execute SQL query and get result

 

$sql_result = mysql_query($sql,$connection) or die("Couldn't execute products query.");

$sqlcount_result = mysql_query($sqlcount,$connection) or die("Couldn't execute query.");

$num = mysql_numrows($sqlcount_result);

mysql_free_result($sqlcount_result);

 

// format results by row

 

while ($row = mysql_fetch_array($sql_result)) {

$id = $row["products_id"];

$model = $row["products_model"];

$image = $row["products_image"];

if (tep_get_products_special_price($id,$connection)) {

if ($tax_special == "1")

$price = round(tep_get_products_special_price($id,$connection)*1.19,2);

else

$price = round(tep_get_products_special_price($id,$connection),2);

} else {

if ($tax_price == "1")

$price = round($row["products_price"]*1.19,2);

else

$price = round($row["products_price"],2);

}

 

// Change below

 

if ($language == '')

$sql2 = "SELECT `products_name`,`products_description` FROM `products_description` WHERE products_id = '$id' LIMIT 1";

else

$sql2 = "SELECT `products_name`,`products_description` FROM `products_description` WHERE products_id = '$id' and language_id = '$language' LIMIT 1";

 

$sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");

$row2 = mysql_fetch_array($sql2_result);

$name = $row2["0"];

 

// add extra data here then add the xml tag below

 

$products_url = $row2["4"];

 

// Change below

 

$products_description = $row2["1"];

 

// add extra data here

 

// Change below

 

// $price = $price + 0.01;

 

echo $domain_name . "/";

echo $id;

echo "\t";

echo $name . "\t";

 

// Change below

 

$prods = str_replace("\t","",$products_description);

$prods = str_replace("<BR>"," ",$prods);

$prods = str_replace("<br>"," ",$prods);

$prods = str_replace("\n"," ",$prods);

$prods = str_replace("\r"," ",$prods);

$prods = str_replace("\l"," ",$prods);

$prods = str_replace("<b>","",$prods);

$prods = str_replace("<B>","",$prods);

$prods = str_replace("</b>","",$prods);

$prods = str_replace("</B>","",$prods);

$prods = str_replace("\"","'",$prods);

 

echo $prods . "\t";

 

// Change below

 

echo sprintf("%.2f",$price) . "\t";

echo $id;

echo "\t" . $domain_name . "/images/" . $image;

echo "\n";

 

?>

 

<?php

 

}

 

// free resources and close connection

 

mysql_free_result($sql_result);

mysql_close($connection);

 

function tep_get_products_special_price($product_id,$connection) {

$sql = "select specials_new_products_price from specials where products_id = '" . (int)$product_id . "' and status";

 

$product_query = mysql_query($sql,$connection) or die("Couldn't execute products query.");

$product = mysql_fetch_array($product_query);

 

return $product['specials_new_products_price'];

}

 

 

?>

Posted

Try:

 

echo "#country_id="4"

 

instead of

 

echo "#country=nl

 

Don't know if it will work, but it's worth a try.

 

Vger

Posted
Try:

 

echo "#country_id="4"

 

instead of

 

echo "#country=nl

 

Don't know if it will work, but it's worth a try.

 

Vger

That didn't work, That row is for the kelkoo txt file and will read on the txt file like this

 

#country=nl

#type=basic

#currency=EUR

 

Neccesary info for kelkoo.

 

All the coding after that is what is called from my db and what I need to make adjustments to.

 

Hoping you have more tipsfor me, in how I can do that,

 

Denice

Posted
That didn't work, That row is for the kelkoo txt file and will read on the txt file like this

 

#country=nl

#type=basic

#currency=EUR

 

Neccesary info for kelkoo.

 

All the coding after that is what is called from my db and what I need to make adjustments to.

 

Hoping you have more tipsfor me, in how I can do that,

 

Denice

 

To eleborate a little better:

 

This part of the code

echo $domain_name . "/product_info.php?products_id=";

shows this in txt file, the product id is correct however when clicked on it, it shows the product info in english and this has to be dutch info

http://www.jewelry-trends.com/product_info.php?products_id=31

 

and the part of the coding for the correct currency that I need to have in the txt file, is not there, so it shows the product price in dollars, where it is called for in the coding however I'm unable to determine.

 

Hoping this helps a little,

 

Denice

Posted
To eleborate a little better:

 

This part of the code

 

shows this in txt file, the product id is correct however when clicked on it, it shows the product info in english and this has to be dutch info

http://www.jewelry-trends.com/product_info.php?products_id=31

 

and the part of the coding for the correct currency that I need to have in the txt file, is not there, so it shows the product price in dollars, where it is called for in the coding however I'm unable to determine.

 

Hoping this helps a little,

 

Denice

anybody????

Posted

try passing the extra parameters for the currency and language with the link

 

currency=EUR

language=de

 

see if it works. And the $products_url = $row2["4"]; is wrong, why not using the tep_db osc functions? and for the array you can use the column names from the sql table much easier to follow.

Posted
try passing the extra parameters for the currency and language with the link

 

currency=EUR

language=de

 

see if it works. And the $products_url = $row2["4"]; is wrong, why not using the tep_db osc functions? and for the array you can use the column names from the sql table much easier to follow.

Could you help me out with implementing your suggestions in above file, like I said,php is not my strongest point. I would highly appriciate your assistants in this

 

Denice

Posted

the mods to insert the language and currency need to take place after

 

echo $domain_name . "/product_info.php?products_id=";
echo $id;

 

so after it you do something like

echo '&currency=EUR';
echo '&language=de';

 

See if the link first is generated to switch language and currency. If it works you need to retrieve the language and currency and replace the hard-coded values with variables.

Posted
the mods to insert the language and currency need to take place after

 

echo $domain_name . "/product_info.php?products_id=";
echo $id;

 

so after it you do something like

echo '&currency=EUR';
echo '&language=de';

 

See if the link first is generated to switch language and currency. If it works you need to retrieve the language and currency and replace the hard-coded values with variables.

Wouw, that worked the link is correctly linking to the dutch product info, however the value of the currency is still in dollar and not in euro. :D

 

The code to determine the language is given more to the top of the file

// 3C: Choose language ! number ! empty is first in db.

 

$language = "4";

 

Is this the part I also have to put the code to determine the value of the currency selected to that it is in euro. To clarify better I don't mean the currency symbol but the price in euro. I hope you can help me with this, and my apoligy for being such a fool with php

 

Denice

Posted

goto your osc admin panel configuration->my store->Switch To Default Language Currency

 

set it to false. and retry.

 

btw are you using just eur and nl for your store?

Posted
goto your osc admin panel configuration->my store->Switch To Default Language Currency

 

set it to false. and retry.

 

btw are you using just eur and nl for your store?

I tried that your admin suggestion, but I didn't work

 

btw are you using just eur and nl for your store?

 

No I have 2 language English and Dutch, but I have 3 currency, 1=$ - 2=Euro - 3= Britisch Pond

 

The kelkoo file needs to look like this:

 

Url - Product Title - Description - Price (without symbol - image url

 

 

*green=correct *red=incorrect

 

The url link, with a big thanks to you, is ok now. My only strugle is now with the price, it takes the default currency value of the dollar while it should take the value of the euro.

 

Denice

Posted

just change the price ratio to match the ratio between usd (default i guess and euro) so instead of

$price = round($row["products_price"]*1.0,2);

 

you do

$price = round($row["products_price"]*1.2,2);

 

and then for the symbol? if you need the symbol just append it right after the code above.

$price = '?' . $price;

Posted

there was a mistake if you need to add the symbol you do it in the sprintf not so early because you will lose the price. So its

 

echo '?' . sprintf("%.2f",$price) . "\t";

Posted
just change the price ratio to match the ratio between usd (default i guess and euro) so instead of

$price = round($row["products_price"]*1.0,2);

 

you do

price = round($row["products_price"]*1.2,2);

 

and then for the symbol? if you need the symbol just append it right after the code above.

$price = '?' . $price;

$price = round($row["products_price"]*1.2,2);

 

That did the trick for me.

 

Thank you enigma, you saved me from totally going crazy, off and on I was busy with this for months.

 

 

Denice

Posted
That did the trick for me.

 

Thank you enigma, you saved me from totally going crazy, off and on I was busy with this for months.

Denice

Oh for members following this thread after the * fill in the currency value as found in your admin, don't forget to change this everytime you upload an new file to kelkoo.

 

This contrib for kelkoo works great for me, with adjustment as given to me in this thread

Kelkoo zip

 

Denice

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...