Forums / Built-in Shipping and Payment Modules / Dynamic Shipping/Delivery Options

Dynamic Shipping/Delivery Options

Locked

Started by organicman on 9 Feb 2010, 10:55 PM · Views: 1,223

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
9 Feb 2010, 10:55 PM
#1
organicman avatar

organicman

New Zenner

Join Date:
Jul 2008
Posts:
13
Plugin Contributions:
0

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.