Dynamic Shipping/Delivery Options
I have used several Zen Cart applications (1.3.8a) effectively for farmers who sell their produce and products directly to local customers via buyers clubs at numerous locations. I have successfully cloned the storepickup shipping module with hand coding, but since there are frequent changes in the details for the numerous pickup sites I would like to be able to let the farmers handle this directly by allowing them to use a database table to edit the text for the unique pickup sites instead of me having to hand code it for each change.
I have added a table named “location” to the Zen Cart db and can query it ok to a simple html table, but am having problems getting the data into the pickup pages. The error message in the Zen Cart Admin shipping module states:
Warning: Constants may only evaluate to scalar values …
Here is some of my code to dynamically provide the TEXT_TITLE:
$con = mysql_connect("localhost","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("zencart", $con);
$query = "SELECT title FROM location WHERE id=1";
$mysql_result = @ mysql_query ($query)
or die ("Query '$query' failed with error message: \"" . mysql_error () . '"');
// Grab one row from our result handle
$row = @ mysql_fetch_row ($mysql_result)
or die ("Try a different query - this one did not return any rows.");
$title=$row;
define('MODULE_SHIPPING_LOCATION1PICKUP_TEXT_TITLE', $title);
Thanks in advance for any help provided in getting this to work.