These plugins are no longer supported:
osCommerce is an online shop e-commerce solution that offers a wide range of out-of-the-box features allowing online stores to be set up quickly, easily and for free as an Open Source based solution released under the GNU General Public License.
osCommerce was started in March 2000 and has since matured to a service that is currently powering 12,263 registered live shops around the world.
To install the Designer contribution for OSCommerce, follow these instructions:
Before uploading any files or making any changes, please make a backup copy of both your database and your files.
Please download the OSCommerce installation package
Within the installation package, find the file: designer.sql
Execute this file either from the mySQL command line or via phpMyAdmin.
If you have a clean install of osCommerce v2.3.1 then copy the contents of "upload" directory of this archive to your store folder with overwriting of existing files and installation will be complete.
OR
If you have already installed other contributions and/or your osCommerce version is different from 2.3.1 then we recommend that you make the edits manually and follow these instructions.
If you have a new installation of osCommerce v2.3.1 or an installation without any contributions added, then you should NOT follow the instructions listed on this page. If you have already installed other contributions and/or your osCommerce version is different from 2.3.1 then you should make the edits required manually as follows:
Step 1: Backup your files
Before uploading any files or making any changes, please make a backup copy of your entire store.
Step 2: Upload component files
Upload following files and folders from "upload" directory to your store folder with keeping directory structure:
Step 3: Edit admin/includes/languages/english/categories.php
Add this code to the file just above the ending ?> tag:
// BOF Personalization function define('TEXT\_PRODUCTS\_ENABLE\_PERSONALIZATION', 'Enable Personalization:'); define('TEXT\_PRODUCTS\_PERSONALIZATION\_TEMPLATE\_ID', 'Template ID:'); // EOF Personalization function
Step 4: Edit admin/includes/languages/english/orders.php
Add this code to the file just above the ending ?> tag:
// BOF Personalization function define('PERSONALIZATION\_PDF\_PROOF', 'PDF proof'); // EOF Personalization function
Step 5: Edit admin/categories.php
Find this code:
$sql\_data\_array = array('products\_quantity' => (int)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_quantity'\]), 'products\_model' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_model'\]), 'products\_price' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_price'\]), 'products\_date\_available' => $products\_date\_available, 'products\_weight' => (float)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_weight'\]), 'products\_status' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_status'\]), 'products\_tax\_class\_id' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_tax\_class\_id'\]), 'manufacturers\_id' => (int)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['manufacturers\_id'\]));
REPLACE with:
$sql\_data\_array = array('products\_quantity' => (int)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_quantity'\]), 'products\_model' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_model'\]), 'products\_price' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_price'\]), 'products\_date\_available' => $products\_date\_available, 'products\_weight' => (float)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_weight'\]), 'products\_status' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_status'\]), 'products\_tax\_class\_id' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_tax\_class\_id'\]), 'manufacturers\_id' => (int)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['manufacturers\_id'\]), // BOF Personalization function 'products\_personalization\_enabled\_flag' => (int)tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_personalization\_enabled\_flag'\]), 'products\_personalization\_template\_id' => tep\_db\_prepare\_input($HTTP\_POST\_VARS\['products\_personalization\_template\_id'\]) // EOF Personalization function );
Find this code:
$product\_query = tep\_db\_query("select products\_quantity, products\_model, products\_image, products\_price, products\_date\_available, products\_weight, products\_tax\_class\_id, manufacturers\_id from " . TABLE\_PRODUCTS . " where products\_id = '" . (int)$products\_id . "'");
REPLACE with:
// BOF Personalization function $product\_query = tep\_db\_query("select products\_quantity, products\_model, products\_image, products\_price, products\_date\_available, products\_weight, products\_tax\_class\_id, manufacturers\_id, products\_personalization\_enabled\_flag, products\_personalization\_template\_id from " . TABLE\_PRODUCTS . " where products\_id = '" . (int)$products\_id . "'"); // EOF Personalization function
Find this code:
tep\_db\_query("insert into " . TABLE\_PRODUCTS . " (products\_quantity, products\_model,products\_image, products\_price, products\_date\_added, products\_date\_available, products\_weight, products\_status, products\_tax\_class\_id, manufacturers\_id) values ('" . tep\_db\_input($product\['products\_quantity'\]) . "', '" . tep\_db\_input($product\['products\_model'\]) . "', '" . tep\_db\_input($product\['products\_image'\]) . "', '" . tep\_db\_input($product\['products\_price'\]) . "', now(), " . (empty($product\['products\_date\_available'\]) ? "null" : "'" . tep\_db\_input($product\['products\_date\_available'\]) . "'") . ", '" . tep\_db\_input($product\['products\_weight'\]) . "', '0', '" . (int)$product\['products\_tax\_class\_id'\] . "', '" . (int)$product\['manufacturers\_id'\] . "')");
REPLACE with:
// BOF Personalization function tep\_db\_query("insert into " . TABLE\_PRODUCTS . " (products\_quantity, products\_model,products\_image, products\_price, products\_date\_added, products\_date\_available, products\_weight, products\_status, products\_tax\_class\_id, manufacturers\_id, products\_personalization\_enabled\_flag, products\_personalization\_template\_id) values ('" . tep\_db\_input($product\['products\_quantity'\]) . "', '" . tep\_db\_input($product\['products\_model'\]) . "', '" . tep\_db\_input($product\['products\_image'\]) . "', '" . tep\_db\_input($product\['products\_price'\]) . "', now(), " . (empty($product\['products\_date\_available'\]) ? "null" : "'" . tep\_db\_input($product\['products\_date\_available'\]) . "'") . ", '" . tep\_db\_input($product\['products\_weight'\]) . "', '0', '" . (int)$product\['products\_tax\_class\_id'\] . "', '" . (int)$product\['manufacturers\_id'\] . "', '" . (int)($product\['products\_personalization\_enabled\_flag'\]). "', '" . tep\_db\_input($product\['products\_personalization\_template\_id'\]) . "')"); // EOF Personalization function
Find this code:
if ($action == 'new\_product') { $parameters = array('products\_name' => '', 'products\_description' => '', 'products\_url' => '', 'products\_id' => '', 'products\_quantity' => '', 'products\_model' => '', 'products\_image' => '', 'products\_larger\_images' => array(), 'products\_price' => '', 'products\_weight' => '', 'products\_date\_added' => '', 'products\_last\_modified' => '', 'products\_date\_available' => '', 'products\_status' => '', 'products\_tax\_class\_id' => '', 'manufacturers\_id' => '');
REPLACE with:
if ($action == 'new\_product') { $parameters = array('products\_name' => '', 'products\_description' => '', 'products\_url' => '', 'products\_id' => '', 'products\_quantity' => '', 'products\_model' => '', 'products\_image' => '', 'products\_larger\_images' => array(), 'products\_price' => '', 'products\_weight' => '', 'products\_date\_added' => '', 'products\_last\_modified' => '', 'products\_date\_available' => '', 'products\_status' => '', 'products\_tax\_class\_id' => '', 'manufacturers\_id' => '', // BOF Personalization function 'products\_personalization\_enabled\_flag' => '', 'products\_personalization\_template\_id' => '' // EOF Personalization function );
Find this code:
$product\_query = tep\_db\_query("select pd.products\_name, pd.products\_description, pd.products\_url, p.products\_id, p.products\_quantity, p.products\_model, p.products\_image, p.products\_price, p.products\_weight, p.products\_date\_added, p.products\_last\_modified, date\_format(p.products\_date\_available, '%Y-%m-%d') as products\_date\_available, p.products\_status, p.products\_tax\_class\_id, p.manufacturers\_id from " . TABLE\_PRODUCTS . " p, " . TABLE\_PRODUCTS\_DESCRIPTION . " pd where p.products\_id = '" . (int)$HTTP\_GET\_VARS\['pID'\] . "' and p.products\_id = pd.products\_id and pd.language\_id = '" . (int)$languages\_id . "'");
REPLACE with:
// BOF Personalization function $product\_query = tep\_db\_query("select pd.products\_name, pd.products\_description, pd.products\_url, p.products\_id, p.products\_quantity, p.products\_model, p.products\_image, p.products\_price, p.products\_weight, p.products\_date\_added, p.products\_last\_modified, date\_format(p.products\_date\_available, '%Y-%m-%d') as products\_date\_available, p.products\_status, p.products\_tax\_class\_id, p.manufacturers\_id, p.products\_personalization\_enabled\_flag, p.products\_personalization\_template\_id from " . TABLE\_PRODUCTS . " p, " . TABLE\_PRODUCTS\_DESCRIPTION . " pd where p.products\_id = '" . (int)$HTTP\_GET\_VARS\['pID'\] . "' and p.products\_id = pd.products\_id and pd.language\_id = '" . (int)$languages\_id . "'"); // EOF Personalization function
Find this code:
<?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> <tr> <td class="main" valign="top"><?php if ($i == 0) echo TEXT\_PRODUCTS\_DESCRIPTION; ?></td> <td><table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main" valign="top"><?php echo tep\_image(DIR\_WS\_CATALOG\_LANGUAGES . $languages\[$i\]\['directory'\] . '/images/' . $languages\[$i\]\['image'\], $languages\[$i\]\['name'\]); ?> </td> <td class="main"><?php echo tep\_draw\_textarea\_field('products\_description\[' . $languages\[$i\]\['id'\] . '\]', 'soft', '70', '15', (isset($products\_description\[$languages\[$i\]\['id'\]\]) ? stripslashes($products\_description\[$languages\[$i\]\['id'\]\]) : tep\_get\_products\_description($pInfo->products\_id, $languages\[$i\]\['id'\]))); ?></td> </tr> </table></td> </tr> <?php } ?>
Add BEFORE:
<!-- BOF Personalization function --> <tr> <td class="main"><?php echo TEXT\_PRODUCTS\_ENABLE\_PERSONALIZATION; ?></td> <td class="main"><?php echo tep\_draw\_separator('pixel\_trans.gif', '24', '15') . ' ' . tep\_draw\_checkbox\_field('products\_personalization\_enabled\_flag', '1', $pInfo->products\_personalization\_enabled\_flag); ?></td> </tr> <tr> <td class="main"><?php echo TEXT\_PRODUCTS\_PERSONALIZATION\_TEMPLATE\_ID; ?></td> <td class="main"><?php echo tep\_draw\_separator('pixel\_trans.gif', '24', '15') . ' ' . tep\_draw\_input\_field('products\_personalization\_template\_id', $pInfo->products\_personalization\_template\_id); ?></td> </tr> <tr> <td colspan="2"><?php echo tep\_draw\_separator('pixel\_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Personalization function -->
Step 6: Edit admin/includes/classes/order.php
Find this code (function "query"):
$orders\_products\_query = tep\_db\_query("select orders\_products\_id, products\_name, products\_model, products\_price, products\_tax, products\_quantity, final\_price from " . TABLE\_ORDERS\_PRODUCTS . " where orders\_id = '" . (int)$order\_id . "'"); while ($orders\_products = tep\_db\_fetch\_array($orders\_products\_query)) { $this->products\[$index\] = array('qty' => $orders\_products\['products\_quantity'\], 'name' => $orders\_products\['products\_name'\], 'model' => $orders\_products\['products\_model'\], 'tax' => $orders\_products\['products\_tax'\], 'price' => $orders\_products\['products\_price'\], 'final\_price' => $orders\_products\['final\_price'\]);
REPLACE with:
$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, -- BOF Personalization function products_personalization_enabled_flag, products_personalization_pdf_url -- EOF Personalization function from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price'], // BOF Personalization function 'personalization_enabled_flag' => $orders_products['products_personalization_enabled_flag'], 'personalization_pdf_url' => $orders_products['products_personalization_pdf_url'] // EOF Personalization function );
Step 7: Edit admin/orders.php
Find this code:
echo ' ' . "\\n" . ' ' . $order->products\[$i\]\['qty'\] . ' x' . "\\n" . ' ' . $order->products\[$i\]\['name'\];
Add AFTER:
// BOF Personalization function if ($order->products\[$i\]\['personalization\_enabled\_flag'\]) { ?> ([](/Designer/shopping_cart/plugins_not_support/oscommerce/installation/manual_edits2/<?php echo $order->products\[$i\]\['personalization\_pdf\_url'\];?>)) <?php } // EOF Personalization function
Step 8: Edit includes/languages/english.php
Add this code to the file just above the ending ?> tag:
// BOF Personalization function define('PERSONALIZATION\_ERROR\_DISABLED', 'Unable to start personalization: personalization is disabled.'); define('PERSONALIZATION\_ERROR\_EMPTY\_TEMPLATE\_ID', 'Unable to start personalization: template ID is empty.'); define('PERSONALIZATION\_ERROR\_EMPTY\_API\_RESPONSE', 'Unable to start personalization: API response was empty.'); define('PERSONALIZATION\_ERROR\_EMPTY\_SESSION\_KEY', 'Unable to start personalization: session key not found.'); define('PERSONALIZATION\_ERROR\_EMPTY\_APP\_URL', 'Unable to start personalization: personalization application URL not found.'); define('PERSONALIZATION\_ERROR\_UNABLE\_TO\_START', 'Unable to start personalization:'); define('PERSONALIZATION\_ERROR\_INVALID\_REQUEST', 'Invalid request.'); define('PERSONALIZATION\_ERROR\_NOT\_COMPLETED', 'Personalization was not completed.'); define('PERSONALIZATION\_ERROR\_FAIL', 'Failed to complete personalization.'); define('PERSONALIZATION\_ERROR\_DETAILS', 'Unable to get personalization details for product.'); define('IMAGE\_BUTTON\_PERSONALIZE', 'Personalize'); // EOF Personalization function
Step 9: Edit includes/filenames.php
Add this code to the file just above the ending ?> tag:
// BOF Personalization function define('FILENAME\_PERSONALIZATION', 'personalization.php'); // EOF Personalization function
Step 10: Edit includes/functions/general.php
Find this code (function tep_get_uprid):
$attributes\_ids .= '{' . (int)$option . '}' . (int)$value;
Add AFTER:
// BOF Personalization function } elseif (($option == 'PSK') && ($value)) { $attributes\_ids .= '{PSK}' . $value; // EOF Personalization function
Find this code (function tep_get_uprid):
$attributes\_ids .= '{' . (int)$pair\[0\] . '}' . (int)$pair\[1\];
Add AFTER:
// BOF Personalization function } elseif (($pair\[0\] == 'PSK') && ($pair\[1\])) { $attributes\_ids .= '{PSK}' . $pair\[1\]; // EOF Personalization function
Add this code to the file just above the ending ?> tag:
// BOF Personalization function function tep\_get\_products\_personalization\_enabled\_flag($products\_id) { $products\_id = intval($products\_id); $sql = 'SELECT products\_personalization\_enabled\_flag FROM ' . TABLE\_PRODUCTS . ' WHERE products\_id = ' . $products\_id; $result = tep\_db\_query($sql); if (!tep\_db\_num\_rows($result)) { return false; } $products\_row = tep\_db\_fetch\_array($result); return $products\_row\['products\_personalization\_enabled\_flag'\]; } // EOF Personalization function
Step 11: Edit includes/classes/shopping_cart.php
Find this code
(function "restore\_contents"):
$qty = $this->contents\[$products\_id\]\['qty'\];
Add AFTER:
// BOF Personalization function $products\_personalization\_session\_key = $this->contents\[$products\_id\]\['products\_personalization\_session\_key'\]; $products\_personalization\_app\_url = $this->contents\[$products\_id\]\['products\_personalization\_app\_url'\]; // EOF Personalization function
Find this code (function "restore_contents"):
tep\_db\_query("insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, customers\_basket\_date\_added) values ('" . (int)$customer\_id . "', '" . tep\_db\_input($products\_id) . "', '" . tep\_db\_input($qty) . "', '" . date('Ymd') . "')");
REPLACE with:
// BOF Personalization function tep\_db\_query("insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, products\_personalization\_session\_key, products\_personalization\_app\_url, customers\_basket\_date\_added) values ('" . (int)$customer\_id . "', '" . tep\_db\_input($products\_id) . "', '" . tep\_db\_input($qty) . "', '" . tep\_db\_input($products\_personalization\_session\_key) . "', '" . tep\_db\_input($products\_personalization\_app\_url) . "', '" . date('Ymd') . "')"); // EOF Personalization function
Find this code (function "restore_contents"):
$products\_query = tep\_db\_query("select products\_id, customers\_basket\_quantity from " . TABLE\_CUSTOMERS\_BASKET . " where customers\_id = '" . (int)$customer\_id . "'");
REPLACE with:
// BOF Personalization function $products\_query = tep\_db\_query("select products\_id, customers\_basket\_quantity, products\_personalization\_session\_key, products\_personalization\_app\_url from " . TABLE\_CUSTOMERS\_BASKET . " where customers\_id = '" . (int)$customer\_id . "'"); // EOF Personalization function
Find this code (function "restore_contents"):
$this->contents\[$products\['products\_id'\]\] = array('qty' => $products\['customers\_basket\_quantity'\]);
REPLACE with:
$this->contents\[$products\['products\_id'\]\] = array( 'qty' => $products\['customers\_basket\_quantity'\], // BOF Personalization function 'products\_personalization\_session\_key' => $products\['products\_personalization\_session\_key'\], 'products\_personalization\_app\_url' => $products\['products\_personalization\_app\_url'\] // EOF Personalization function );
Find this code:
function reset($reset\_database = false) { global $customer\_id;
Add AFTER:
// BOF Personalization function if (is\_array($this->contents) && ($reset\_database)) { foreach ($this->contents as $product) { if (!empty($product\['products\_personalization\_session\_key'\])) { // finish personalization session $PersonalizationAPI = new PersonalizationAPI(); $PersonalizationAPI->endPersonalization($product\['products\_personalization\_session\_key'\]); } } } // EOF Personalization function
Find this code:
function add\_cart($products\_id, $qty = '1', $attributes = '', $notify = true) {
REPLACE with:
// BOF Personalization function function add\_cart($products\_id, $qty = '1', $attributes = '', $notify = true, $products\_personalization\_session\_key = '', $products\_personalization\_app\_url = '') { // EOF Personalization function
Find this code (function "add_cart"):
$products\_id\_string = tep\_get\_uprid($products\_id, $attributes);
REPLACE with:
// BOF Personalization function if ($products\_personalization\_session\_key) { $params = $attributes; $params\['PSK'\] = $products\_personalization\_session\_key; $products\_id\_string = tep\_get\_uprid($products\_id, $params); } else { $products\_id\_string = tep\_get\_uprid($products\_id, $attributes); } // EOF Personalization function
Find this code (function "add_cart"):
if ($this->in\_cart($products\_id\_string)) { $this->update\_quantity($products\_id\_string, $qty, $attributes); } else { $this->contents\[$products\_id\_string\] = array('qty' => (int)$qty); // insert into database if (tep\_session\_is\_registered('customer\_id')) tep\_db\_query("insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, customers\_basket\_date\_added) values ('" . (int)$customer\_id . "', '" . tep\_db\_input($products\_id\_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");
REPLACE with:
if ($this->in\_cart($products\_id\_string)) { // BOF Personalization function $this->update\_quantity($products\_id\_string, $qty, $attributes, $products\_personalization\_session\_key); // EOF Personalization function } else { $this->contents\[$products\_id\_string\] = array( 'qty' => (int)$qty, // BOF Personalization function 'products\_personalization\_session\_key' => $products\_personalization\_session\_key, 'products\_personalization\_app\_url' => $products\_personalization\_app\_url // EOF Personalization function ); // insert into database // BOF Personalization function if (tep\_session\_is\_registered('customer\_id')) tep\_db\_query("insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, products\_personalization\_session\_key, products\_personalization\_app\_url, customers\_basket\_date\_added) values ('" . (int)$customer\_id . "', '" . tep\_db\_input($products\_id\_string) . "', '" . (int)$qty . "', '" . tep\_db\_input($products\_personalization\_session\_key) . "', '" . tep\_db\_input($products\_personalization\_app\_url) . "', '" . date('Ymd') . "')"); // EOF Personalization function
Find this code:
function update\_quantity($products\_id, $quantity = '', $attributes = '') {
REPLACE with:
// BOF Personalization function function update\_quantity($products\_id, $quantity = '', $attributes = '', $products\_personalization\_session\_key = '') { // EOF Personalization function
Find this code (function "update_quantity"):
$products\_id\_string = tep\_get\_uprid($products\_id, $attributes);
REPLACE with:
// BOF Personalization function if ($products\_personalization\_session\_key) { $params = $attributes; $params\['PSK'\] = $products\_personalization\_session\_key; $products\_id\_string = tep\_get\_uprid($products\_id, $params); } else { $products\_id\_string = tep\_get\_uprid($products\_id, $attributes); } // EOF Personalization function
Find this code (function "update_quantity"):
$this->contents\[$products\_id\_string\] = array('qty' => (int)$quantity);
REPLACE with:
// BOF Personalization function $this->contents\[$products\_id\_string\]\['qty'\] = (int)$quantity; // EOF Personalization function
Find this code (function "cleanup"):
if ($this->contents\[$key\]\['qty'\] < 1) {
REPLACE with:
// BOF Personalization function $products\_personalization\_enabled\_flag = tep\_get\_products\_personalization\_enabled\_flag(tep\_get\_prid($key)); // EOF Personalization function if (($this->contents\[$key\]\['qty'\] < 1) // BOF Personalization function || ($products\_personalization\_enabled\_flag && empty($this->contents\[$key\]\['products\_personalization\_session\_key'\])) || (!empty($this->contents\[$key\]\['products\_personalization\_session\_key'\]) && !$products\_personalization\_enabled\_flag)) { if (!empty($this->contents\[$key\]\['products\_personalization\_session\_key'\])) { // finish personalization session $PersonalizationAPI = new PersonalizationAPI(); $PersonalizationAPI->endPersonalization($this->contents\[$key\]\['products\_personalization\_session\_key'\]); } // EOF Personalization function
Find this code:
function remove($products\_id) { global $customer\_id;
Add AFTER:
// BOF Personalization function if (!empty($this->contents\[$products\_id\]\['products\_personalization\_session\_key'\])) { // finish personalization session $PersonalizationAPI = new PersonalizationAPI(); $PersonalizationAPI->endPersonalization($this->contents\[$products\_id\]\['products\_personalization\_session\_key'\]); } // EOF Personalization function
Find this code (function "get_products"):
'attributes' => (isset($this->contents\[$products\_id\]\['attributes'\]) ? $this->contents\[$products\_id\]\['attributes'\] : ''));
REPLACE with:
'attributes' => (isset($this->contents\[$products\_id\]\['attributes'\]) ? $this->contents\[$products\_id\]\['attributes'\] : ''), // BOF Personalization function 'personalization\_session\_key' => $this->contents\[$products\_id\]\['products\_personalization\_session\_key'\], 'personalization\_app\_url' => $this->contents\[$products\_id\]\['products\_personalization\_app\_url'\] // EOF Personalization function );
Step 12: Edit includes/classes/order.php
Find this code (function "cart"):
$this->products\[$index\] = array('qty' => $products\[$i\]\['quantity'\], 'name' => $products\[$i\]\['name'\], 'model' => $products\[$i\]\['model'\], 'tax' => tep\_get\_tax\_rate($products\[$i\]\['tax\_class\_id'\], $tax\_address\['entry\_country\_id'\], $tax\_address\['entry\_zone\_id'\]), 'tax\_description' => tep\_get\_tax\_description($products\[$i\]\['tax\_class\_id'\], $tax\_address\['entry\_country\_id'\], $tax\_address\['entry\_zone\_id'\]), 'price' => $products\[$i\]\['price'\], 'final\_price' => $products\[$i\]\['price'\] + $cart->attributes\_price($products\[$i\]\['id'\]), 'weight' => $products\[$i\]\['weight'\], 'id' => $products\[$i\]\['id'\]);
REPLACE with:
$this->products\[$index\] = array('qty' => $products\[$i\]\['quantity'\], 'name' => $products\[$i\]\['name'\], 'model' => $products\[$i\]\['model'\], 'tax' => tep\_get\_tax\_rate($products\[$i\]\['tax\_class\_id'\], $tax\_address\['entry\_country\_id'\], $tax\_address\['entry\_zone\_id'\]), 'tax\_description' => tep\_get\_tax\_description($products\[$i\]\['tax\_class\_id'\], $tax\_address\['entry\_country\_id'\], $tax\_address\['entry\_zone\_id'\]), 'price' => $products\[$i\]\['price'\], 'final\_price' => $products\[$i\]\['price'\] + $cart->attributes\_price($products\[$i\]\['id'\]), 'weight' => $products\[$i\]\['weight'\], 'id' => $products\[$i\]\['id'\], // BOF Personalization function 'personalization\_session\_key' => $products\[$i\]\['personalization\_session\_key'\] // EOF Personalization function );
Step 13: Edit checkout_process.php
Find this code:
require(DIR\_WS\_CLASSES . 'order.php'); $order = new order;
Add AFTER:
// BOF Personalization function $PersonalizationAPI = new PersonalizationAPI(); $products\_personalization\_data = array(); for ($i=0; $i<sizeof($order->products); $i++) { $products\_id = $order->products\[$i\]\['id'\]; if (!empty($order->products\[$i\]\['personalization\_session\_key'\])) { $response = $PersonalizationAPI->getPreview($order->products\[$i\]\['personalization\_session\_key'\]); if (!$response->getFaultCode()) { $products\_personalization\_data\[$products\_id\]\['personalization\_enabled\_flag'\] = 1; $products\_personalization\_data\[$products\_id\]\['personalization\_pdf\_url'\] = $response->getPdfUrl(); } else { $cart->remove($products\_id); $messageStack->add\_session('header', PERSONALIZATION\_ERROR\_DETAILS); tep\_redirect(tep\_href\_link(FILENAME\_SHOPPING\_CART)); } } else { $products\_personalization\_data\[$products\_id\]\['personalization\_enabled\_flag'\] = 0; $products\_personalization\_data\[$products\_id\]\['personalization\_pdf\_url'\] = ''; } } // EOF Personalization function
Find this code:
$sql\_data\_array = array('orders\_id' => $insert\_id, 'products\_id' => tep\_get\_prid($order->products\[$i\]\['id'\]), 'products\_model' => $order->products\[$i\]\['model'\], 'products\_name' => $order->products\[$i\]\['name'\], 'products\_price' => $order->products\[$i\]\['price'\], 'final\_price' => $order->products\[$i\]\['final\_price'\], 'products\_tax' => $order->products\[$i\]\['tax'\], 'products\_quantity' => $order->products\[$i\]\['qty'\]);
REPLACE with:
$sql\_data\_array = array('orders\_id' => $insert\_id, 'products\_id' => tep\_get\_prid($order->products\[$i\]\['id'\]), 'products\_model' => $order->products\[$i\]\['model'\], 'products\_name' => $order->products\[$i\]\['name'\], 'products\_price' => $order->products\[$i\]\['price'\], 'final\_price' => $order->products\[$i\]\['final\_price'\], 'products\_tax' => $order->products\[$i\]\['tax'\], 'products\_quantity' => $order->products\[$i\]\['qty'\], // BOF Personalization function 'products\_personalization\_enabled\_flag' => $products\_personalization\_data\[$order->products\[$i\]\['id'\]\]\['personalization\_enabled\_flag'\], 'products\_personalization\_pdf\_url' => $products\_personalization\_data\[$order->products\[$i\]\['id'\]\]\['personalization\_pdf\_url'\] // EOF Personalization function );
Step 14: Edit includes/application_top.php
REMOVE this code:
// infobox require(DIR\_WS\_CLASSES . 'boxes.php');
REMOVE this code:
// initialize the message stack for output messages require(DIR\_WS\_CLASSES . 'message\_stack.php'); $messageStack = new messageStack;
Find this code:
require(DIR\_WS\_CLASSES . 'email.php');
Add AFTER:
// infobox require(DIR\_WS\_CLASSES . 'boxes.php'); // initialize the message stack for output messages require(DIR\_WS\_CLASSES . 'message\_stack.php'); $messageStack = new messageStack; // BOF Personalization function require(DIR\_WS\_CLASSES . 'personalization\_api.php'); require(DIR\_WS\_CLASSES . 'personalization.php'); // EOF Personalization function
Find this code:
case 'update\_product' : for ($i=0, $n=sizeof($HTTP\_POST\_VARS\['products\_id'\]); $i<$n; $i++) { if (in\_array($HTTP\_POST\_VARS\['products\_id'\]\[$i\], (is\_array($HTTP\_POST\_VARS\['cart\_delete'\]) ? $HTTP\_POST\_VARS\['cart\_delete'\] : array()))) { $cart->remove($HTTP\_POST\_VARS\['products\_id'\]\[$i\]); } else { $attributes = ($HTTP\_POST\_VARS\['id'\]\[$HTTP\_POST\_VARS\['products\_id'\]\[$i\]\]) ? $HTTP\_POST\_VARS\['id'\]\[$HTTP\_POST\_VARS\['products\_id'\]\[$i\]\] : ''; $cart->add\_cart($HTTP\_POST\_VARS\['products\_id'\]\[$i\], $HTTP\_POST\_VARS\['cart\_quantity'\]\[$i\], $attributes, false); } } tep\_redirect(tep\_href\_link($goto, tep\_get\_all\_get\_params($parameters))); break;
REPLACE with:
case 'update\_product' : for ($i=0, $n=sizeof($HTTP\_POST\_VARS\['products\_id'\]); $i<$n; $i++) { if (in\_array($HTTP\_POST\_VARS\['products\_id'\]\[$i\], (is\_array($HTTP\_POST\_VARS\['cart\_delete'\]) ? $HTTP\_POST\_VARS\['cart\_delete'\] : array()))) { $cart->remove($HTTP\_POST\_VARS\['products\_id'\]\[$i\]); } else { $attributes = ($HTTP\_POST\_VARS\['id'\]\[$HTTP\_POST\_VARS\['products\_id'\]\[$i\]\]) ? $HTTP\_POST\_VARS\['id'\]\[$HTTP\_POST\_VARS\['products\_id'\]\[$i\]\] : ''; // BOF Personalization function if (isset($HTTP\_POST\_VARS\['products\_personalization\_session\_key'\]\[$HTTP\_POST\_VARS\['products\_id'\]\[$i\]\])) { $products\_personalization\_session\_key = $HTTP\_POST\_VARS\['products\_personalization\_session\_key'\]\[$HTTP\_POST\_VARS\['products\_id'\]\[$i\]\]; } else { $products\_personalization\_session\_key = ''; } $cart->add\_cart($HTTP\_POST\_VARS\['products\_id'\]\[$i\], $HTTP\_POST\_VARS\['cart\_quantity'\]\[$i\], $attributes, false, $products\_personalization\_session\_key); // EOF Personalization function } } tep\_redirect(tep\_href\_link($goto, tep\_get\_all\_get\_params($parameters))); break;
Find this code:
case 'add\_product' : if (isset($HTTP\_POST\_VARS\['products\_id'\]) && is\_numeric($HTTP\_POST\_VARS\['products\_id'\])) {
Add AFTER:
// BOF Personalization function if (tep\_get\_products\_personalization\_enabled\_flag($HTTP\_POST\_VARS\['products\_id'\])) { Personalization::start(); } // EOF Personalization function
Find this code:
case 'buy\_now' : if (isset($HTTP\_GET\_VARS\['products\_id'\])) { if (tep\_has\_product\_attributes($HTTP\_GET\_VARS\['products\_id'\])) { tep\_redirect(tep\_href\_link(FILENAME\_PRODUCT\_INFO, 'products\_id=' . $HTTP\_GET\_VARS\['products\_id'\])); } else {
Add AFTER:
// BOF Personalization function if (tep\_get\_products\_personalization\_enabled\_flag($HTTP\_GET\_VARS\['products\_id'\])) { Personalization::start(); } // EOF Personalization function
Step 15: Edit product_info.php
Find this code:
<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?>
REPLACE with:
<?php
echo tep_draw_hidden_field('products_id', $product_info['products_id']);
// BOF Personalization function
if (!tep_get_products_personalization_enabled_flag($product_info['products_id'])) {
echo tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary');
}
else {
echo tep_draw_button(IMAGE_BUTTON_PERSONALIZE, 'document', null, 'primary');
}
// EOF Personalization function
?>
Step 16: Edit shopping_cart.php
Find this code:
<h1><?php echo HEADING_TITLE; ?></h1>
Add BEFORE:
<!-- BOF Personalization function -->
<script type="text/javascript" src="ext/jquery/jquery.cycle/jquery.cycle.lite.min.js"></script>
<script type="text/javascript" src="ext/jquery/jquery.cycle/personalization.gallery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("a.pgImg").fancybox();
})
</script>
<!-- EOF Personalization function -->
Find this code:
$any\_out\_of\_stock = 0; $products = $cart->get\_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products\[$i\]\['attributes'\]) && is\_array($products\[$i\]\['attributes'\])) { while (list($option, $value) = each($products\[$i\]\['attributes'\])) { echo tep\_draw\_hidden\_field('id\[' . $products\[$i\]\['id'\] . '\]\[' . $option . '\]', $value); $attributes = tep\_db\_query("select popt.products\_options\_name, poval.products\_options\_values\_name, pa.options\_values\_price, pa.price\_prefix from " . TABLE\_PRODUCTS\_OPTIONS . " popt, " . TABLE\_PRODUCTS\_OPTIONS\_VALUES . " poval, " . TABLE\_PRODUCTS\_ATTRIBUTES . " pa where pa.products\_id = '" . (int)$products\[$i\]\['id'\] . "' and pa.options\_id = '" . (int)$option . "' and pa.options\_id = popt.products\_options\_id and pa.options\_values\_id = '" . (int)$value . "' and pa.options\_values\_id = poval.products\_options\_values\_id and popt.language\_id = '" . (int)$languages\_id . "' and poval.language\_id = '" . (int)$languages\_id . "'"); $attributes\_values = tep\_db\_fetch\_array($attributes); $products\[$i\]\[$option\]\['products\_options\_name'\] = $attributes\_values\['products\_options\_name'\]; $products\[$i\]\[$option\]\['options\_values\_id'\] = $value; $products\[$i\]\[$option\]\['products\_options\_values\_name'\] = $attributes\_values\['products\_options\_values\_name'\]; $products\[$i\]\[$option\]\['options\_values\_price'\] = $attributes\_values\['options\_values\_price'\]; $products\[$i\]\[$option\]\['price\_prefix'\] = $attributes\_values\['price\_prefix'\]; } }
Add AFTER:
// BOF Personalization function if (!empty($products\[$i\]\['personalization\_session\_key'\])) { $PersonalizationAPI = new PersonalizationAPI(); $response = $PersonalizationAPI->getPreview($products\[$i\]\['personalization\_session\_key'\]); if (!$response->getFaultCode()) { $products\[$i\]\['personalization\_pdf\_url'\] = $response->getPdfUrl(); $products\[$i\]\['personalization\_preview\_images'\] = $response->getPeviewUrls(); echo tep\_draw\_hidden\_field('products\_personalization\_session\_key\[' . $products\[$i\]\['id'\] . '\]', $products\[$i\]\['personalization\_session\_key'\]); } else { $cart->remove($products\[$i\]\['id'\]); unset($products\[$i\]); } } // EOF Personalization function
Find this code:
$products\_name = '' . ' ' . ' ' . '[' . tep\_image(DIR\_WS\_IMAGES . $products\[$i\]\['image'\], $products\[$i\]\['name'\], SMALL\_IMAGE\_WIDTH, SMALL\_IMAGE\_HEIGHT) . '](' . tep\_href\_link(FILENAME\_PRODUCT\_INFO, 'products\_id=' . $products\[$i\]\['id'\]) . ')[**' . $products\[$i\]\['name'\] . '**](' . tep\_href\_link(FILENAME\_PRODUCT\_INFO, 'products\_id=' . $products\[$i\]\['id'\]) . ')';
REPLACE with:
$products\_name = '' . ' '; // BOF Personalization function if ($products\[$i\]\['personalization\_session\_key'\]) { $products\_name .= ' '; } // EOF Personalization function else { $products\_name .= ' '; } $products\_name .= '
| | | |
| --- | --- | --- |
| ' . '<br><br>'; for ($j=0; $j<sizeof($products\[$i\]\['personalization\_preview\_images'\]); $j++) { $class = ($j == 0) ? 'class="first"' : ''; $products\_name .= ' [<img src="' . $products\[$i\]\['personalization\_preview\_images'\]\[$j\] . '" width="200" alt="' . $products\[$i\]\['name'\] . '" ' . $class . ' />](' . $products\[$i\]\['personalization\_preview\_images'\]\[$j\] . ')'; } $products\_name .= '<br><br>' . ' | [' . tep\_image(DIR\_WS\_IMAGES . $products\[$i\]\['image'\], $products\[$i\]\['name'\], SMALL\_IMAGE\_WIDTH, SMALL\_IMAGE\_HEIGHT) . '](' . tep\_href\_link(FILENAME\_PRODUCT\_INFO, 'products\_id=' . $products\[$i\]\['id'\]) . ') | [**' . $products\[$i\]\['name'\] . '**](' . tep\_href\_link(FILENAME\_PRODUCT\_INFO, 'products\_id=' . $products\[$i\]\['id'\]) . ')';<br><br>Find this code:<br><br>$products\_name .= ' <br> <br>' . tep\_draw\_input\_field('cart\_quantity\[\]', $products\[$i\]\['quantity'\], 'size="4"') . tep\_draw\_hidden\_field('products\_id\[\]', $products\[$i\]\['id'\]) . tep\_draw\_button(IMAGE\_BUTTON\_UPDATE, 'refresh') . ' or [remove](' . tep\_href\_link(FILENAME\_SHOPPING\_CART, 'products\_id=' . $products\[$i\]\['id'\] . '&action=remove\_product') . ')';<br><br>REPLACE with:<br><br>$products\_name .= ' <br> <br>' . tep\_draw\_input\_field('cart\_quantity\[\]', $products\[$i\]\['quantity'\], 'size="4"') . tep\_draw\_hidden\_field('products\_id\[\]', $products\[$i\]\['id'\]) . tep\_draw\_button(IMAGE\_BUTTON\_UPDATE, 'refresh'); // BOF Personalization function if ($products\[$i\]\['personalization\_session\_key'\]) { $products\_name .= ' ' . tep\_draw\_button(IMAGE\_BUTTON\_PERSONALIZE, 'document', tep\_href\_link(FILENAME\_PERSONALIZATION, 'action=start\_shopping\_cart&products\_id=' . $products\[$i\]\['id'\])); } // EOF Personalization function $products\_name .= ' or [remove](' . tep\_href\_link(FILENAME\_SHOPPING\_CART, 'products\_id=' . $products\[$i\]\['id'\] . '&action=remove\_product') . ')';<br><br>**Step 17: Edit stylesheet.css**<br><br>Add to the end of the file:<br><br>/\* BOF Personalization function \*/ .personalizationGallery { width: 200px; } .personalizationGallery img { width: 200px; display: none; } .personalizationGallery img.first { display: block; } /\* EOF Personalization function \*/ |
ZenCart
Zen Cart™ is an online store management system. It is PHP-based, using a MySQL database and HTML components. Support is provided for numerous languages and currencies, and it is freely available under the GNU General Public License.
Zen Cart™ branched from osCommerce as a separate project in 2003. Beyond some aesthetic changes, the major differences between the two systems come from Zen Cart™'s architectural changes (for example, a template system) and additional included features in the core. Among the feature improvements include a Gift Certificate/Voucher module which allows a user to create, send and manage the digital coupons and ability to sell downloads (PDF or other media files). The release of the 1.3.x series further differentiated Zen Cart™ by moving the template system from its historic tables-based layout approach to one that is largely CSS-based.
To install the Designer contribution for ZenCart, follow these instructions:
Before uploading any files or making any changes, please make a backup copy of both your database and your files.
Please download the ZenCart installation package
Within the installation package, find the file: designer.sql
Execute this file either from the mySQL command line or via phpMyAdmin.
If you have a clean install of ZenCart v1.3.9h then copy the contents of "upload" directory of this archive to your store folder with overwriting of existing files and installation will be complete.
OR
If you have already installed other contributions and/or your ZenCart version is different from 1.3.9h then we recommend that you make the edits manually and follow these instructions.
If you have a new installation of ZenCart v1.3.9h or an installation without any contributions added, then you should NOT follow the instructions listed on this page. If you have already installed other contributions and/or your ZenCart version is different from 1.3.9h then you should make the edits required manually as follows:
Step 1: Backup your files
Before uploading any files or making any changes, please make a backup copy of your entire store.
Step 2a: Upload template files
If you're using a template other than the default template then the following files:
Should be copied to:
Otherwise keep directory structure as it is.
Step 2b: Upload component files
Upload following the files and folders from "upload" directory to your store folder with keeping directory structure:
Step 3: Edit admin/includes/modules/product/collect_info.php
Find this code:
$parameters = array('products\_name' => '', 'products\_description' => '', 'products\_url' => '', 'products\_id' => '', 'products\_quantity' => '', 'products\_model' => '', 'products\_image' => '', 'products\_price' => '', 'products\_virtual' => DEFAULT\_PRODUCT\_PRODUCTS\_VIRTUAL, 'products\_weight' => '', 'products\_date\_added' => '', 'products\_last\_modified' => '', 'products\_date\_available' => '', 'products\_status' => '', 'products\_tax\_class\_id' => DEFAULT\_PRODUCT\_TAX\_CLASS\_ID, 'manufacturers\_id' => '', 'products\_quantity\_order\_min' => '', 'products\_quantity\_order\_units' => '', 'products\_priced\_by\_attribute' => '', 'product\_is\_free' => '', 'product\_is\_call' => '', 'products\_quantity\_mixed' => '', 'product\_is\_always\_free\_shipping' => DEFAULT\_PRODUCT\_PRODUCTS\_IS\_ALWAYS\_FREE\_SHIPPING, 'products\_qty\_box\_status' => PRODUCTS\_QTY\_BOX\_STATUS, 'products\_quantity\_order\_max' => '0', 'products\_sort\_order' => '0', 'products\_discount\_type' => '0', 'products\_discount\_type\_from' => '0', 'products\_price\_sorter' => '0', 'master\_categories\_id' => '' );
REPLACE with:
$parameters = array('products\_name' => '', 'products\_description' => '', 'products\_url' => '', 'products\_id' => '', 'products\_quantity' => '', 'products\_model' => '', 'products\_image' => '', 'products\_price' => '', 'products\_virtual' => DEFAULT\_PRODUCT\_PRODUCTS\_VIRTUAL, 'products\_weight' => '', 'products\_date\_added' => '', 'products\_last\_modified' => '', 'products\_date\_available' => '', 'products\_status' => '', 'products\_tax\_class\_id' => DEFAULT\_PRODUCT\_TAX\_CLASS\_ID, 'manufacturers\_id' => '', 'products\_quantity\_order\_min' => '', 'products\_quantity\_order\_units' => '', 'products\_priced\_by\_attribute' => '', 'product\_is\_free' => '', 'product\_is\_call' => '', 'products\_quantity\_mixed' => '', 'product\_is\_always\_free\_shipping' => DEFAULT\_PRODUCT\_PRODUCTS\_IS\_ALWAYS\_FREE\_SHIPPING, 'products\_qty\_box\_status' => PRODUCTS\_QTY\_BOX\_STATUS, 'products\_quantity\_order\_max' => '0', 'products\_sort\_order' => '0', 'products\_discount\_type' => '0', 'products\_discount\_type\_from' => '0', 'products\_price\_sorter' => '0', 'master\_categories\_id' => '', // BOF Personalization function 'products\_personalization\_enabled\_flag' => '', 'products\_personalization\_template\_id' => '' // EOF Personalization function );
Find this code:
$product = $db->Execute("select pd.products\_name, pd.products\_description, pd.products\_url, p.products\_id, p.products\_quantity, p.products\_model, p.products\_image, p.products\_price, p.products\_virtual, p.products\_weight, p.products\_date\_added, p.products\_last\_modified, date\_format(p.products\_date\_available, '%Y-%m-%d') as products\_date\_available, p.products\_status, p.products\_tax\_class\_id, p.manufacturers\_id, p.products\_quantity\_order\_min, p.products\_quantity\_order\_units, p.products\_priced\_by\_attribute, p.product\_is\_free, p.product\_is\_call, p.products\_quantity\_mixed, p.product\_is\_always\_free\_shipping, p.products\_qty\_box\_status, p.products\_quantity\_order\_max, p.products\_sort\_order, p.products\_discount\_type, p.products\_discount\_type\_from, p.products\_price\_sorter, p.master\_categories\_id from " . TABLE\_PRODUCTS . " p, " . TABLE\_PRODUCTS\_DESCRIPTION . " pd where p.products\_id = '" . (int)$\_GET\['pID'\] . "' and p.products\_id = pd.products\_id and pd.language\_id = '" . (int)$\_SESSION\['languages\_id'\] . "'");
REPLACE with:
$product = $db->Execute("select pd.products\_name, pd.products\_description, pd.products\_url, p.products\_id, p.products\_quantity, p.products\_model, p.products\_image, p.products\_price, p.products\_virtual, p.products\_weight, p.products\_date\_added, p.products\_last\_modified, date\_format(p.products\_date\_available, '%Y-%m-%d') as products\_date\_available, p.products\_status, p.products\_tax\_class\_id, p.manufacturers\_id, p.products\_quantity\_order\_min, p.products\_quantity\_order\_units, p.products\_priced\_by\_attribute, p.product\_is\_free, p.product\_is\_call, p.products\_quantity\_mixed, p.product\_is\_always\_free\_shipping, p.products\_qty\_box\_status, p.products\_quantity\_order\_max, p.products\_sort\_order, p.products\_discount\_type, p.products\_discount\_type\_from, p.products\_price\_sorter, p.master\_categories\_id, -- BOF Personalization function p.products\_personalization\_enabled\_flag, p.products\_personalization\_template\_id -- EOF Personalization function from " . TABLE\_PRODUCTS . " p, " . TABLE\_PRODUCTS\_DESCRIPTION . " pd where p.products\_id = '" . (int)$\_GET\['pID'\] . "' and p.products\_id = pd.products\_id and pd.language\_id = '" . (int)$\_SESSION\['languages\_id'\] . "'");
Find this code:
<tr bgcolor="#ebebff"> <td class="main"><?php echo TEXT\_PRODUCTS\_PRICE\_GROSS; ?></td> <td class="main"><?php echo zen\_draw\_separator('pixel\_trans.gif', '24', '15') . ' ' . zen\_draw\_input\_field('products\_price\_gross', $pInfo->products\_price, 'OnKeyUp="updateNet()"'); ?></td> </tr> <tr> <td colspan="2"><?php echo zen\_draw\_separator('pixel\_trans.gif', '1', '10'); ?></td> </tr>
Add AFTER:
<!-- BOF Personalization function --> <tr> <td class="main"><?php echo TEXT\_PRODUCTS\_ENABLE\_PERSONALIZATION; ?></td> <td class="main"><?php echo zen\_draw\_separator('pixel\_trans.gif', '24', '15') . ' ' . zen\_draw\_checkbox\_field('products\_personalization\_enabled\_flag', '1', $pInfo->products\_personalization\_enabled\_flag); ?></td> </tr> <tr> <td class="main"><?php echo TEXT\_PRODUCTS\_PERSONALIZATION\_TEMPLATE\_ID; ?></td> <td class="main"><?php echo zen\_draw\_separator('pixel\_trans.gif', '24', '15') . ' ' . zen\_draw\_input\_field('products\_personalization\_template\_id', $pInfo->products\_personalization\_template\_id); ?></td> </tr> <tr> <td colspan="2"><?php echo zen\_draw\_separator('pixel\_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Personalization function -->
Step 4: Edit admin/includes/modules/update_product.php
Find this code:
$sql\_data\_array = array('products\_quantity' => $products\_quantity, 'products\_type' => zen\_db\_prepare\_input($\_GET\['product\_type'\]), 'products\_model' => zen\_db\_prepare\_input($\_POST\['products\_model'\]), 'products\_price' => $products\_price, 'products\_date\_available' => $products\_date\_available, 'products\_weight' => $products\_weight, 'products\_status' => zen\_db\_prepare\_input((int)$\_POST\['products\_status'\]), 'products\_virtual' => zen\_db\_prepare\_input((int)$\_POST\['products\_virtual'\]), 'products\_tax\_class\_id' => zen\_db\_prepare\_input((int)$\_POST\['products\_tax\_class\_id'\]), 'manufacturers\_id' => $manufacturers\_id, 'products\_quantity\_order\_min' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_order\_min'\]), 'products\_quantity\_order\_units' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_order\_units'\]), 'products\_priced\_by\_attribute' => zen\_db\_prepare\_input($\_POST\['products\_priced\_by\_attribute'\]), 'product\_is\_free' => zen\_db\_prepare\_input((int)$\_POST\['product\_is\_free'\]), 'product\_is\_call' => zen\_db\_prepare\_input((int)$\_POST\['product\_is\_call'\]), 'products\_quantity\_mixed' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_mixed'\]), 'product\_is\_always\_free\_shipping' => zen\_db\_prepare\_input((int)$\_POST\['product\_is\_always\_free\_shipping'\]), 'products\_qty\_box\_status' => zen\_db\_prepare\_input($\_POST\['products\_qty\_box\_status'\]), 'products\_quantity\_order\_max' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_order\_max'\]), 'products\_sort\_order' => (int)zen\_db\_prepare\_input($\_POST\['products\_sort\_order'\]), 'products\_discount\_type' => zen\_db\_prepare\_input($\_POST\['products\_discount\_type'\]), 'products\_discount\_type\_from' => zen\_db\_prepare\_input($\_POST\['products\_discount\_type\_from'\]), 'products\_price\_sorter' => zen\_db\_prepare\_input($\_POST\['products\_price\_sorter'\]) );
REPLACE with:
$sql\_data\_array = array('products\_quantity' => $products\_quantity, 'products\_type' => zen\_db\_prepare\_input($\_GET\['product\_type'\]), 'products\_model' => zen\_db\_prepare\_input($\_POST\['products\_model'\]), 'products\_price' => $products\_price, 'products\_date\_available' => $products\_date\_available, 'products\_weight' => $products\_weight, 'products\_status' => zen\_db\_prepare\_input((int)$\_POST\['products\_status'\]), 'products\_virtual' => zen\_db\_prepare\_input((int)$\_POST\['products\_virtual'\]), 'products\_tax\_class\_id' => zen\_db\_prepare\_input((int)$\_POST\['products\_tax\_class\_id'\]), 'manufacturers\_id' => $manufacturers\_id, 'products\_quantity\_order\_min' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_order\_min'\]), 'products\_quantity\_order\_units' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_order\_units'\]), 'products\_priced\_by\_attribute' => zen\_db\_prepare\_input($\_POST\['products\_priced\_by\_attribute'\]), 'product\_is\_free' => zen\_db\_prepare\_input((int)$\_POST\['product\_is\_free'\]), 'product\_is\_call' => zen\_db\_prepare\_input((int)$\_POST\['product\_is\_call'\]), 'products\_quantity\_mixed' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_mixed'\]), 'product\_is\_always\_free\_shipping' => zen\_db\_prepare\_input((int)$\_POST\['product\_is\_always\_free\_shipping'\]), 'products\_qty\_box\_status' => zen\_db\_prepare\_input($\_POST\['products\_qty\_box\_status'\]), 'products\_quantity\_order\_max' => zen\_db\_prepare\_input($\_POST\['products\_quantity\_order\_max'\]), 'products\_sort\_order' => (int)zen\_db\_prepare\_input($\_POST\['products\_sort\_order'\]), 'products\_discount\_type' => zen\_db\_prepare\_input($\_POST\['products\_discount\_type'\]), 'products\_discount\_type\_from' => zen\_db\_prepare\_input($\_POST\['products\_discount\_type\_from'\]), 'products\_price\_sorter' => zen\_db\_prepare\_input($\_POST\['products\_price\_sorter'\]), // BOF Personalization function 'products\_personalization\_enabled\_flag' => intval($\_POST\['products\_personalization\_enabled\_flag'\]), 'products\_personalization\_template\_id' => zen\_db\_prepare\_input($\_POST\['products\_personalization\_template\_id'\]) // EOF Personalization function );
Step 5: Edit admin/includes/modules/copy_to_confirm.php
Find this code:
$product = $db->Execute("select products\_type, products\_quantity, products\_model, products\_image, products\_price, products\_virtual, products\_date\_available, products\_weight, products\_tax\_class\_id, manufacturers\_id, products\_quantity\_order\_min, products\_quantity\_order\_units, products\_priced\_by\_attribute, product\_is\_free, product\_is\_call, products\_quantity\_mixed, product\_is\_always\_free\_shipping, products\_qty\_box\_status, products\_quantity\_order\_max, products\_sort\_order, products\_price\_sorter, master\_categories\_id from " . TABLE\_PRODUCTS . " where products\_id = '" . (int)$products\_id . "'");
REPLACE with:
$product = $db->Execute("select products\_type, products\_quantity, products\_model, products\_image, products\_price, products\_virtual, products\_date\_available, products\_weight, products\_tax\_class\_id, manufacturers\_id, products\_quantity\_order\_min, products\_quantity\_order\_units, products\_priced\_by\_attribute, product\_is\_free, product\_is\_call, products\_quantity\_mixed, product\_is\_always\_free\_shipping, products\_qty\_box\_status, products\_quantity\_order\_max, products\_sort\_order, products\_price\_sorter, master\_categories\_id, -- BOF Personalization function products\_personalization\_enabled\_flag, products\_personalization\_template\_id -- EOF Personalization function from " . TABLE\_PRODUCTS . " where products\_id = '" . (int)$products\_id . "'");
Find this code:
$db->Execute("insert into " . TABLE\_PRODUCTS . " (products\_type, products\_quantity, products\_model, products\_image, products\_price, products\_virtual, products\_date\_added, products\_date\_available, products\_weight, products\_status, products\_tax\_class\_id, manufacturers\_id, products\_quantity\_order\_min, products\_quantity\_order\_units, products\_priced\_by\_attribute, product\_is\_free, product\_is\_call, products\_quantity\_mixed, product\_is\_always\_free\_shipping, products\_qty\_box\_status, products\_quantity\_order\_max, products\_sort\_order, products\_price\_sorter, master\_categories\_id ) values ('" . zen\_db\_input($product->fields\['products\_type'\]) . "', '" . $products\_quantity . "', '" . zen\_db\_input($product->fields\['products\_model'\]) . "', '" . zen\_db\_input($product->fields\['products\_image'\]) . "', '" . $products\_price . "', '" . zen\_db\_input($product->fields\['products\_virtual'\]) . "', now(), '" . (zen\_not\_null(zen\_db\_input($product->fields\['products\_date\_available'\])) ? zen\_db\_input($product->fields\['products\_date\_available'\]) : '0001-01-01 00:00:00') . "', '" . $products\_weight . "', '0', '" . (int)$product->fields\['products\_tax\_class\_id'\] . "', '" . (int)$product->fields\['manufacturers\_id'\] . "', '" . zen\_db\_input($product->fields\['products\_quantity\_order\_min'\]) . "', '" . zen\_db\_input($product->fields\['products\_quantity\_order\_units'\]) . "', '" . zen\_db\_input($product->fields\['products\_priced\_by\_attribute'\]) . "', '" . (int)$product->fields\['product\_is\_free'\] . "', '" . (int)$product->fields\['product\_is\_call'\] . "', '" . (int)$product->fields\['products\_quantity\_mixed'\] . "', '" . zen\_db\_input($product->fields\['product\_is\_always\_free\_shipping'\]) . "', '" . zen\_db\_input($product->fields\['products\_qty\_box\_status'\]) . "', '" . zen\_db\_input($product->fields\['products\_quantity\_order\_max'\]) . "', '" . zen\_db\_input($product->fields\['products\_sort\_order'\]) . "', '" . zen\_db\_input($product->fields\['products\_price\_sorter'\]) . "', '" . zen\_db\_input($categories\_id) . "')");
REPLACE with:
$db->Execute("insert into " . TABLE\_PRODUCTS . " (products\_type, products\_quantity, products\_model, products\_image, products\_price, products\_virtual, products\_date\_added, products\_date\_available, products\_weight, products\_status, products\_tax\_class\_id, manufacturers\_id, products\_quantity\_order\_min, products\_quantity\_order\_units, products\_priced\_by\_attribute, product\_is\_free, product\_is\_call, products\_quantity\_mixed, product\_is\_always\_free\_shipping, products\_qty\_box\_status, products\_quantity\_order\_max, products\_sort\_order, products\_price\_sorter, master\_categories\_id, -- BOF Personalization function products\_personalization\_enabled\_flag, products\_personalization\_template\_id -- EOF Personalization function ) values ('" . zen\_db\_input($product->fields\['products\_type'\]) . "', '" . $products\_quantity . "', '" . zen\_db\_input($product->fields\['products\_model'\]) . "', '" . zen\_db\_input($product->fields\['products\_image'\]) . "', '" . $products\_price . "', '" . zen\_db\_input($product->fields\['products\_virtual'\]) . "', now(), '" . (zen\_not\_null(zen\_db\_input($product->fields\['products\_date\_available'\])) ? zen\_db\_input($product->fields\['products\_date\_available'\]) : '0001-01-01 00:00:00') . "', '" . $products\_weight . "', '0', '" . (int)$product->fields\['products\_tax\_class\_id'\] . "', '" . (int)$product->fields\['manufacturers\_id'\] . "', '" . zen\_db\_input($product->fields\['products\_quantity\_order\_min'\]) . "', '" . zen\_db\_input($product->fields\['products\_quantity\_order\_units'\]) . "', '" . zen\_db\_input($product->fields\['products\_priced\_by\_attribute'\]) . "', '" . (int)$product->fields\['product\_is\_free'\] . "', '" . (int)$product->fields\['product\_is\_call'\] . "', '" . (int)$product->fields\['products\_quantity\_mixed'\] . "', '" . zen\_db\_input($product->fields\['product\_is\_always\_free\_shipping'\]) . "', '" . zen\_db\_input($product->fields\['products\_qty\_box\_status'\]) . "', '" . zen\_db\_input($product->fields\['products\_quantity\_order\_max'\]) . "', '" . zen\_db\_input($product->fields\['products\_sort\_order'\]) . "', '" . zen\_db\_input($product->fields\['products\_price\_sorter'\]) . "', '" . zen\_db\_input($categories\_id) . "', '" . /\* BOF Personalization function \*/ intval($product->fields\['products\_personalization\_enabled\_flag'\]) . "', '" . zen\_db\_input($product->fields\['products\_personalization\_template\_id'\]) /\* EOF Personalization function \*/ . "')");
Step 6: Edit admin/includes/classes/order.php
Find this code (function "query"):
$orders\_products = $db->Execute("select orders\_products\_id, products\_id, products\_name, products\_model, products\_price, products\_tax, products\_quantity, final\_price, onetime\_charges, product\_is\_free from " . TABLE\_ORDERS\_PRODUCTS . " where orders\_id = '" . (int)$order\_id . "' order by orders\_products\_id");
REPLACE with:
$orders\_products = $db->Execute("select orders\_products\_id, products\_id, products\_name, products\_model, products\_price, products\_tax, products\_quantity, final\_price, onetime\_charges, product\_is\_free, -- BOF Personalization function products\_personalization\_enabled\_flag, products\_personalization\_pdf\_url -- EOF Personalization function from " . TABLE\_ORDERS\_PRODUCTS . " where orders\_id = '" . (int)$order\_id . "' order by orders\_products\_id");
Find this code (function "query"):
$this->products\[$index\] = array('qty' => $new\_qty, 'id' => $orders\_products->fields\['products\_id'\], 'name' => $orders\_products->fields\['products\_name'\], 'model' => $orders\_products->fields\['products\_model'\], 'tax' => $orders\_products->fields\['products\_tax'\], 'price' => $orders\_products->fields\['products\_price'\], 'onetime\_charges' => $orders\_products->fields\['onetime\_charges'\], 'final\_price' => $orders\_products->fields\['final\_price'\], 'product\_is\_free' => $orders\_products->fields\['product\_is\_free'\]);
REPLACE with:
$this->products\[$index\] = array('qty' => $new\_qty, 'id' => $orders\_products->fields\['products\_id'\], 'name' => $orders\_products->fields\['products\_name'\], 'model' => $orders\_products->fields\['products\_model'\], 'tax' => $orders\_products->fields\['products\_tax'\], 'price' => $orders\_products->fields\['products\_price'\], 'onetime\_charges' => $orders\_products->fields\['onetime\_charges'\], 'final\_price' => $orders\_products->fields\['final\_price'\], 'product\_is\_free' => $orders\_products->fields\['product\_is\_free'\], // BOF Personalization function 'personalization\_enabled\_flag' => $orders\_products->fields\['products\_personalization\_enabled\_flag'\], 'personalization\_pdf\_url' => $orders\_products->fields\['products\_personalization\_pdf\_url'\] // EOF Personalization function );
Step 7: Edit admin/orders.php
Find this code:
echo ' <tr class="dataTableRow">' . "\\n" . ' <td class="dataTableContent" valign="top" align="right">' . $order->products\[$i\]\['qty'\] . ' x</td>' . "\\n" . ' <td class="dataTableContent" valign="top">' . $order->products\[$i\]\['name'\];
Add AFTER:
// BOF Personalization function if ($order->products\[$i\]\['personalization\_enabled\_flag'\]) { ?> (<a href="<?php echo $order->products\[$i\]\['personalization\_pdf\_url'\];?>" target="\_blank"><?php echo PERSONALIZATION\_PDF\_PROOF; ?></a>) <?php } // EOF Personalization function
Step 8: Edit includes/classes/shopping_cart.php
Find this code (function "restore_contents"):
$qty = $this->contents\[$products\_id\]\['qty'\];
Add AFTER:
// BOF Personalization function $products\_personalization\_session\_key = $this->contents\[$products\_id\]\['products\_personalization\_session\_key'\]; $products\_personalization\_app\_url = $this->contents\[$products\_id\]\['products\_personalization\_app\_url'\]; // EOF Personalization function
Find this code (function "restore_contents"):
$sql = "insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, customers\_basket\_date\_added) values ('" . (int)$\_SESSION\['customer\_id'\] . "', '" . zen\_db\_input($products\_id) . "', '" . $qty . "', '" . date('Ymd') . "')";
REPLACE with:
// BOF Personalization function $sql = "insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, products\_personalization\_session\_key, products\_personalization\_app\_url, customers\_basket\_date\_added) values ('" . (int)$\_SESSION\['customer\_id'\] . "', '" . zen\_db\_input($products\_id) . "', '" . $qty . "', '" . zen\_db\_input($products\_personalization\_session\_key) . "', '" . zen\_db\_input($products\_personalization\_app\_url) . "', '" . date('Ymd') . "')"; // EOF Personalization function
Find this code (function "restore_contents"):
$products\_query = "select products\_id, customers\_basket\_quantity from " . TABLE\_CUSTOMERS\_BASKET . " where customers\_id = '" . (int)$\_SESSION\['customer\_id'\] . "'";
REPLACE with:
// BOF Personalization function $products\_query = "select products\_id, customers\_basket\_quantity, products\_personalization\_session\_key, products\_personalization\_app\_url from " . TABLE\_CUSTOMERS\_BASKET . " where customers\_id = '" . (int)$\_SESSION\['customer\_id'\] . "'"; // EOF Personalization function
Find this code (function "restore_contents"):
$this->contents\[$products->fields\['products\_id'\]\] = array('qty' => $products->fields\['customers\_basket\_quantity'\]);
REPLACE with:
$this->contents\[$products->fields\['products\_id'\]\] = array( 'qty' => $products->fields\['customers\_basket\_quantity'\], // BOF Personalization function 'products\_personalization\_session\_key' => $products->fields\['products\_personalization\_session\_key'\], 'products\_personalization\_app\_url' => $products->fields\['products\_personalization\_app\_url'\], // EOF Personalization function );
Find this code:
function reset($reset\_database = false) { global $db;
Add AFTER:
// BOF Personalization function if (is\_array($this->contents) && ($reset\_database)) { foreach ($this->contents as $product) { if (!empty($product\['products\_personalization\_session\_key'\])) { // finish personalization session $PersonalizationAPI = new PersonalizationAPI(); $PersonalizationAPI->endPersonalization($product\['products\_personalization\_session\_key'\]); } } } // EOF Personalization function
Find this code:
\* @param integer the product ID of the item to be added \* @param decimal the quantity of the item to be added \* @param array any attributes that are attache to the product \* @param boolean whether to add the product to the notify list \* @return void \* @global object access to the db object \* @todo ICW - documentation stub \*/ function add\_cart($products\_id, $qty = '1', $attributes = '', $notify = true) {
REPLACE with:
\* @param integer the product ID of the item to be added \* @param decimal the quantity of the item to be added \* @param array any attributes that are attache to the product \* @param boolean whether to add the product to the notify list \* @param string personalization session key \* @param string personalization application URL \* @return void \* @global object access to the db object \* @todo ICW - documentation stub \*/ // BOF Personalization function function add\_cart($products\_id, $qty = '1', $attributes = '', $notify = true, $products\_personalization\_session\_key = '', $products\_personalization\_app\_url = '') { // EOF Personalization function
Find this code (function "add_cart"):
$products\_id = zen\_get\_uprid($products\_id, $attributes);
REPLACE with:
// BOF Personalization function if ($products\_personalization\_session\_key) { $params = $attributes; $params\['PSK'\] = $products\_personalization\_session\_key; $products\_id = zen\_get\_uprid($products\_id, $params); } else { $products\_id = zen\_get\_uprid($products\_id, $attributes); } // EOF Personalization function
Find this code (function "add_cart"):
$this->contents\[$products\_id\] = array('qty' => (float)$qty);
REPLACE with:
$this->contents\[$products\_id\] = array( 'qty' => (float)$qty, // BOF Personalization function 'products\_personalization\_session\_key' => $products\_personalization\_session\_key, 'products\_personalization\_app\_url' => $products\_personalization\_app\_url // EOF Personalization function );
Find this code (function "add_cart"):
$sql = "insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, customers\_basket\_date\_added) values ('" . (int)$\_SESSION\['customer\_id'\] . "', '" . zen\_db\_input($products\_id) . "', '" . $qty . "', '" . date('Ymd') . "')";
REPLACE with:
// BOF Personalization function $sql = "insert into " . TABLE\_CUSTOMERS\_BASKET . " (customers\_id, products\_id, customers\_basket\_quantity, products\_personalization\_session\_key, products\_personalization\_app\_url, customers\_basket\_date\_added) values ('" . (int)$\_SESSION\['customer\_id'\] . "', '" . zen\_db\_input($products\_id) . "', '" . $qty . "', '" . zen\_db\_input($products\_personalization\_session\_key) . "', '" . zen\_db\_input($products\_personalization\_app\_url) . "', '" . date('Ymd') . "')"; // EOF Personalization function
Find this code (function "update_quantity"):
$this->contents\[$products\_id\] = array('qty' => (float)$quantity);
REPLACE with:
// BOF Personalization function $this->contents\[$products\_id\]\['qty'\] = (float)$quantity; // EOF Personalization function
Find this code (function "cleanup"):
if (!isset($this->contents\[$key\]\['qty'\]) || $this->contents\[$key\]\['qty'\] <= 0) {
REPLACE with:
// BOF Personalization function $products\_personalization\_enabled\_flag = zen\_get\_products\_personalization\_enabled\_flag(zen\_get\_prid($key)); // EOF Personalization function if ((!isset($this->contents\[$key\]\['qty'\]) || $this->contents\[$key\]\['qty'\] <= 0) // BOF Personalization function || ($products\_personalization\_enabled\_flag && empty($this->contents\[$key\]\['products\_personalization\_session\_key'\])) || (!empty($this->contents\[$key\]\['products\_personalization\_session\_key'\]) && !$products\_personalization\_enabled\_flag)) { if (!empty($this->contents\[$key\]\['products\_personalization\_session\_key'\])) { // finish personalization session $PersonalizationAPI = new PersonalizationAPI(); $PersonalizationAPI->endPersonalization($this->contents\[$key\]\['products\_personalization\_session\_key'\]); } // EOF Personalization function
Find this code:
function remove($products\_id) { global $db; $this->notify('NOTIFIER\_CART\_REMOVE\_START');
Add AFTER:
// BOF Personalization function if (!empty($this->contents\[$products\_id\]\['products\_personalization\_session\_key'\])) { // finish personalization session $PersonalizationAPI = new PersonalizationAPI(); $PersonalizationAPI->endPersonalization($this->contents\[$products\_id\]\['products\_personalization\_session\_key'\]); } // EOF Personalization function
Find this code (function "get_products"):
$products\_array\[\] = array('id' => $products\_id, 'category' => $products->fields\['master\_categories\_id'\], 'name' => $products->fields\['products\_name'\], 'model' => $products->fields\['products\_model'\], 'image' => $products->fields\['products\_image'\], 'price' => ($products->fields\['product\_is\_free'\] =='1' ? 0 : $products\_price), // 'quantity' => $this->contents\[$products\_id\]\['qty'\], 'quantity' => $new\_qty, 'weight' => $products->fields\['products\_weight'\] + $this->attributes\_weight($products\_id), // fix here 'final\_price' => ($products\_price + $this->attributes\_price($products\_id)), 'onetime\_charges' => ($this->attributes\_price\_onetime\_charges($products\_id, $new\_qty)), 'tax\_class\_id' => $products->fields\['products\_tax\_class\_id'\], 'attributes' => (isset($this->contents\[$products\_id\]\['attributes'\]) ? $this->contents\[$products\_id\]\['attributes'\] : ''), 'attributes\_values' => (isset($this->contents\[$products\_id\]\['attributes\_values'\]) ? $this->contents\[$products\_id\]\['attributes\_values'\] : ''), 'products\_priced\_by\_attribute' => $products->fields\['products\_priced\_by\_attribute'\], 'product\_is\_free' => $products->fields\['product\_is\_free'\], 'products\_discount\_type' => $products->fields\['products\_discount\_type'\], 'products\_discount\_type\_from' => $products->fields\['products\_discount\_type\_from'\]);
REPLACE with:
$products\_array\[\] = array('id' => $products\_id, 'category' => $products->fields\['master\_categories\_id'\], 'name' => $products->fields\['products\_name'\], 'model' => $products->fields\['products\_model'\], 'image' => $products->fields\['products\_image'\], 'price' => ($products->fields\['product\_is\_free'\] =='1' ? 0 : $products\_price), // 'quantity' => $this->contents\[$products\_id\]\['qty'\], 'quantity' => $new\_qty, 'weight' => $products->fields\['products\_weight'\] + $this->attributes\_weight($products\_id), // fix here 'final\_price' => ($products\_price + $this->attributes\_price($products\_id)), 'onetime\_charges' => ($this->attributes\_price\_onetime\_charges($products\_id, $new\_qty)), 'tax\_class\_id' => $products->fields\['products\_tax\_class\_id'\], 'attributes' => (isset($this->contents\[$products\_id\]\['attributes'\]) ? $this->contents\[$products\_id\]\['attributes'\] : ''), 'attributes\_values' => (isset($this->contents\[$products\_id\]\['attributes\_values'\]) ? $this->contents\[$products\_id\]\['attributes\_values'\] : ''), 'products\_priced\_by\_attribute' => $products->fields\['products\_priced\_by\_attribute'\], 'product\_is\_free' => $products->fields\['product\_is\_free'\], 'products\_discount\_type' => $products->fields\['products\_discount\_type'\], 'products\_discount\_type\_from' => $products->fields\['products\_discount\_type\_from'\], // BOF Personalization function 'personalization\_session\_key' => $this->contents\[$products\_id\]\['products\_personalization\_session\_key'\], 'personalization\_app\_url' => $this->contents\[$products\_id\]\['products\_personalization\_app\_url'\] // EOF Personalization function );
Find this code (function "actionAddProduct"):
$this->add\_cart($\_POST\['products\_id'\], $this->get\_quantity(zen\_get\_uprid($\_POST\['products\_id'\], $real\_ids))+($new\_qty), $real\_ids);
Add BEFORE:
// BOF Personalization function if (zen\_get\_products\_personalization\_enabled\_flag($\_POST\['products\_id'\])) { $redirect\_url = zen\_href\_link($goto, zen\_get\_all\_get\_params($parameters)); Personalization::start($\_POST\['products\_id'\], $new\_qty, $real\_ids, $redirect\_url); } // EOF Personalization function
Step 9: Edit includes/classes/order.php
Find this code (function "cart"):
$this->products\[$index\] = array('qty' => $products\[$i\]\['quantity'\], 'name' => $products\[$i\]\['name'\], 'model' => $products\[$i\]\['model'\], 'tax' => zen\_get\_tax\_rate($products\[$i\]\['tax\_class\_id'\], $tax\_address->fields\['entry\_country\_id'\], $tax\_address->fields\['entry\_zone\_id'\]), 'tax\_groups'=>$taxRates, 'tax\_description' => zen\_get\_tax\_description($products\[$i\]\['tax\_class\_id'\], $tax\_address->fields\['entry\_country\_id'\], $tax\_address->fields\['entry\_zone\_id'\]), 'price' => $products\[$i\]\['price'\], 'final\_price' => $products\[$i\]\['price'\] + $\_SESSION\['cart'\]->attributes\_price($products\[$i\]\['id'\]), 'onetime\_charges' => $\_SESSION\['cart'\]->attributes\_price\_onetime\_charges($products\[$i\]\['id'\], $products\[$i\]\['quantity'\]), 'weight' => $products\[$i\]\['weight'\], 'products\_priced\_by\_attribute' => $products\[$i\]\['products\_priced\_by\_attribute'\], 'product\_is\_free' => $products\[$i\]\['product\_is\_free'\], 'products\_discount\_type' => $products\[$i\]\['products\_discount\_type'\], 'products\_discount\_type\_from' => $products\[$i\]\['products\_discount\_type\_from'\], 'id' => $products\[$i\]\['id'\], 'rowClass' => $rowClass);
REPLACE with:
$this->products\[$index\] = array('qty' => $products\[$i\]\['quantity'\], 'name' => $products\[$i\]\['name'\], 'model' => $products\[$i\]\['model'\], 'tax' => zen\_get\_tax\_rate($products\[$i\]\['tax\_class\_id'\], $tax\_address->fields\['entry\_country\_id'\], $tax\_address->fields\['entry\_zone\_id'\]), 'tax\_groups'=>$taxRates, 'tax\_description' => zen\_get\_tax\_description($products\[$i\]\['tax\_class\_id'\], $tax\_address->fields\['entry\_country\_id'\], $tax\_address->fields\['entry\_zone\_id'\]), 'price' => $products\[$i\]\['price'\], 'final\_price' => $products\[$i\]\['price'\] + $\_SESSION\['cart'\]->attributes\_price($products\[$i\]\['id'\]), 'onetime\_charges' => $\_SESSION\['cart'\]->attributes\_price\_onetime\_charges($products\[$i\]\['id'\], $products\[$i\]\['quantity'\]), 'weight' => $products\[$i\]\['weight'\], 'products\_priced\_by\_attribute' => $products\[$i\]\['products\_priced\_by\_attribute'\], 'product\_is\_free' => $products\[$i\]\['product\_is\_free'\], 'products\_discount\_type' => $products\[$i\]\['products\_discount\_type'\], 'products\_discount\_type\_from' => $products\[$i\]\['products\_discount\_type\_from'\], // BOF Personalization function 'personalization\_session\_key' => $products\[$i\]\['personalization\_session\_key'\], 'personalization\_app\_url' => $products\[$i\]\['personalization\_app\_url'\], // EOF Personalization function 'id' => $products\[$i\]\['id'\], 'rowClass' => $rowClass);
Find this code (function "create_add_products"):
$sql\_data\_array = array('orders\_id' => $zf\_insert\_id, 'products\_id' => zen\_get\_prid($this->products\[$i\]\['id'\]), 'products\_model' => $this->products\[$i\]\['model'\], 'products\_name' => $this->products\[$i\]\['name'\], 'products\_price' => $this->products\[$i\]\['price'\], 'final\_price' => $this->products\[$i\]\['final\_price'\], 'onetime\_charges' => $this->products\[$i\]\['onetime\_charges'\], 'products\_tax' => $this->products\[$i\]\['tax'\], 'products\_quantity' => $this->products\[$i\]\['qty'\], 'products\_priced\_by\_attribute' => $this->products\[$i\]\['products\_priced\_by\_attribute'\], 'product\_is\_free' => $this->products\[$i\]\['product\_is\_free'\], 'products\_discount\_type' => $this->products\[$i\]\['products\_discount\_type'\], 'products\_discount\_type\_from' => $this->products\[$i\]\['products\_discount\_type\_from'\], 'products\_prid' => $this->products\[$i\]\['id'\]);
REPLACE with:
$sql\_data\_array = array('orders\_id' => $zf\_insert\_id, 'products\_id' => zen\_get\_prid($this->products\[$i\]\['id'\]), 'products\_model' => $this->products\[$i\]\['model'\], 'products\_name' => $this->products\[$i\]\['name'\], 'products\_price' => $this->products\[$i\]\['price'\], 'final\_price' => $this->products\[$i\]\['final\_price'\], 'onetime\_charges' => $this->products\[$i\]\['onetime\_charges'\], 'products\_tax' => $this->products\[$i\]\['tax'\], 'products\_quantity' => $this->products\[$i\]\['qty'\], 'products\_priced\_by\_attribute' => $this->products\[$i\]\['products\_priced\_by\_attribute'\], 'product\_is\_free' => $this->products\[$i\]\['product\_is\_free'\], 'products\_discount\_type' => $this->products\[$i\]\['products\_discount\_type'\], 'products\_discount\_type\_from' => $this->products\[$i\]\['products\_discount\_type\_from'\], 'products\_prid' => $this->products\[$i\]\['id'\], // BOF Personalization function 'products\_personalization\_enabled\_flag' => $this->products\[$i\]\['personalization\_enabled\_flag'\], 'products\_personalization\_pdf\_url' => $this->products\[$i\]\['personalization\_pdf\_url'\] // EOF Personalization function );
Step 10: Edit includes/modules/checkout_process.php
Find this code:
if (!isset($\_SESSION\['payment'\]) && $credit\_covers === FALSE) { zen\_redirect(zen\_href\_link(FILENAME\_DEFAULT)); }
Add AFTER:
// BOF Personalization function $PersonalizationAPI = new PersonalizationAPI(); for ($i=0; $i<sizeof($order->products); $i++) { if (!empty($order->products\[$i\]\['personalization\_session\_key'\])) { $response = $PersonalizationAPI->getPreview($order->products\[$i\]\['personalization\_session\_key'\]); if (!$response->getFaultCode()) { $order->products\[$i\]\['personalization\_enabled\_flag'\] = 1; $order->products\[$i\]\['personalization\_pdf\_url'\] = $response->getPdfUrl(); } else { $\_SESSION\['cart'\]->remove($order->products\[$i\]\['id'\]); $messageStack->add\_session('header', PERSONALIZATION\_ERROR\_DETAILS); zen\_redirect(zen\_href\_link(FILENAME\_SHOPPING\_CART)); } } else { $order->products\[$i\]\['personalization\_enabled\_flag'\] = 0; $order->products\[$i\]\['personalization\_pdf\_url'\] = ''; } } // EOF Personalization function
Step 11: Edit includes/modules/pages/product_info/main_template_vars.php
Find this code:
$zco\_notifier->notify('NOTIFY\_MAIN\_TEMPLATE\_VARS\_EXTRA\_PRODUCT\_INFO');
Add AFTER:
// BOF Personalization function $products\_personalization\_enabled\_flag = zen\_get\_products\_personalization\_enabled\_flag($\_GET\['products\_id'\]); // EOF Personalization function
**Step 12: Edit includes/templates/YOUR\_TEMPLATE/templates/tpl\_product\_info\_display.php**
Find this code:
$display\_qty = (($flag\_show\_product\_info\_in\_cart\_qty == 1 and $\_SESSION\['cart'\]->in\_cart($\_GET\['products\_id'\])) ? '<p>' . PRODUCTS\_ORDER\_QTY\_TEXT\_IN\_CART . $\_SESSION\['cart'\]->get\_quantity($\_GET\['products\_id'\]) . '</p>' : '');
Add BEFORE:
// BOF Personalization function if ($products\_personalization\_enabled\_flag) { $image\_submit = zen\_image\_submit(BUTTON\_IMAGE\_PERSONALIZE, BUTTON\_PERSONALIZE\_ALT); } else { $image\_submit = zen\_image\_submit(BUTTON\_IMAGE\_IN\_CART, BUTTON\_IN\_CART\_ALT); } // EOF Personalization function
Find this code:
$the\_button = '<input type="hidden" name="cart\_quantity" value="1" />' . zen\_draw\_hidden\_field('products\_id', (int)$\_GET\['products\_id'\]) . zen\_image\_submit(BUTTON\_IMAGE\_IN\_CART, BUTTON\_IN\_CART\_ALT);
REPLACE with:
// BOF Personalization function $the\_button = '<input type="hidden" name="cart\_quantity" value="1" />' . zen\_draw\_hidden\_field('products\_id', (int)$\_GET\['products\_id'\]) . $image\_submit; // EOF Personalization function
Find this code:
$the\_button = PRODUCTS\_ORDER\_QTY\_TEXT . '<input type="text" name="cart\_quantity" value="' . (zen\_get\_buy\_now\_qty($\_GET\['products\_id'\])) . '" maxlength="6" size="4" /><br />' . zen\_get\_products\_quantity\_min\_units\_display((int)$\_GET\['products\_id'\]) . '<br />' . zen\_draw\_hidden\_field('products\_id', (int)$\_GET\['products\_id'\]) . zen\_image\_submit(BUTTON\_IMAGE\_IN\_CART, BUTTON\_IN\_CART\_ALT);
REPLACE with:
// BOF Personalization function $the\_button = PRODUCTS\_ORDER\_QTY\_TEXT . '<input type="text" name="cart\_quantity" value="' . (zen\_get\_buy\_now\_qty($\_GET\['products\_id'\])) . '" maxlength="6" size="4" /><br />' . zen\_get\_products\_quantity\_min\_units\_display((int)$\_GET\['products\_id'\]) . '<br />' . zen\_draw\_hidden\_field('products\_id', (int)$\_GET\['products\_id'\]) . $image\_submit; // EOF Personalization function
Step 13: Edit includes/modules/product_listing.php
Find this code:
if (zen\_has\_product\_attributes($listing->fields\['products\_id'\]) or PRODUCT\_LIST\_PRICE\_BUY\_NOW == '0') {
REPLACE with:
// BOF Personalization function if (zen\_has\_product\_attributes($listing->fields\['products\_id'\]) or zen\_get\_products\_personalization\_enabled\_flag($listing->fields\['products\_id'\]) or PRODUCT\_LIST\_PRICE\_BUY\_NOW == '0') { // EOF Personalization function
Step 14: Edit includes/modules/pages/shopping_cart/header_php.php
Find this code:
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
Add AFTER:
// BOF Personalization function $products\_personalization\_pdf\_url = ''; $products\_personalization\_preview\_images = ''; if (!empty($products\[$i\]\['personalization\_session\_key'\])) { $PersonalizationAPI = new PersonalizationAPI(); $response = $PersonalizationAPI->getPreview($products\[$i\]\['personalization\_session\_key'\]); if (!$response->getFaultCode()) { $products\_personalization\_pdf\_url = $response->getPdfUrl(); $products\_personalization\_preview\_images = $response->getPeviewUrls(); } else { $messageStack->add('header', PERSONALIZATION\_ERROR\_DETAILS); $\_SESSION\['cart'\]->remove($products\[$i\]\['id'\]); continue; } } // EOF Personalization function
Find this code:
$productArray\[$i\] = array('attributeHiddenField'=>$attributeHiddenField, 'flagStockCheck'=>$flagStockCheck, 'flagShowFixedQuantity'=>$showFixedQuantity, 'linkProductsImage'=>$linkProductsImage, 'linkProductsName'=>$linkProductsName, 'productsImage'=>$productsImage, 'productsName'=>$productsName, 'showFixedQuantity'=>$showFixedQuantity, 'showFixedQuantityAmount'=>$showFixedQuantityAmount, 'showMinUnits'=>$showMinUnits, 'quantityField'=>$quantityField, 'buttonUpdate'=>$buttonUpdate, 'productsPrice'=>$productsPriceTotal, 'productsPriceEach'=>$productsPriceEach, 'rowClass'=>$rowClass, 'buttonDelete'=>$buttonDelete, 'checkBoxDelete'=>$checkBoxDelete, 'id'=>$products\[$i\]\['id'\], 'attributes'=>$attrArray);
REPLACE with:
$productArray\[$i\] = array('attributeHiddenField'=>$attributeHiddenField, 'flagStockCheck'=>$flagStockCheck, 'flagShowFixedQuantity'=>$showFixedQuantity, 'linkProductsImage'=>$linkProductsImage, 'linkProductsName'=>$linkProductsName, 'productsImage'=>$productsImage, 'productsName'=>$productsName, 'showFixedQuantity'=>$showFixedQuantity, 'showFixedQuantityAmount'=>$showFixedQuantityAmount, 'showMinUnits'=>$showMinUnits, 'quantityField'=>$quantityField, 'buttonUpdate'=>$buttonUpdate, 'productsPrice'=>$productsPriceTotal, 'productsPriceEach'=>$productsPriceEach, 'rowClass'=>$rowClass, 'buttonDelete'=>$buttonDelete, 'checkBoxDelete'=>$checkBoxDelete, 'id'=>$products\[$i\]\['id'\], 'attributes'=>$attrArray, // BOF Personalization function 'personalization\_session\_key' => $products\[$i\]\['personalization\_session\_key'\], 'personalization\_pdf\_url' => $products\_personalization\_pdf\_url, 'personalization\_preview\_images' => $products\_personalization\_preview\_images // EOF Personalization function );
Step 15: Edit includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php
Find this code:
<a href="<?php echo $product\['linkProductsName'\]; ?>"><span id="cartImage" class="back"><?php echo $product\['productsImage'\]; ?></span><span id="cartProdTitle"><?php echo $product\['productsName'\] . '<span class="alert bold">' . $product\['flagStockCheck'\] . '</span>'; ?></span></a>
REPLACE with:
<?php // BOF Personalization function if (!$product\['personalization\_session\_key'\]) { ?> <a href="<?php echo $product\['linkProductsName'\]; ?>"><span id="cartImage" class="back"><?php echo $product\['productsImage'\]; ?></span><span id="cartProdTitle"><?php echo $product\['productsName'\] . '<span class="alert bold">' . $product\['flagStockCheck'\] . '</span>'; ?></span></a> <?php } else { ?> <div class="personalizationGallery"> <?php for ($j=0; $j<sizeof($product\['personalization\_preview\_images'\]); $j++) { $class = ($j == 0) ? 'class="first"' : ''; ?> <a href="<?php echo $product\['personalization\_preview\_images'\]\[$j\]; ?>" rel="fancybox\[<?php echo $product\['personalization\_session\_key'\]; ?>\]" class="back pgImg" target="\_blank"><img src="<?php echo $product\['personalization\_preview\_images'\]\[$j\]; ?>" width="200" alt="<?php echo $product\['productsName'\]; ?>" <?php echo $class; ?> /></a> <?php } ?> </div> <br /> <a href="<?php echo $product\['linkProductsName'\]; ?>" class="personaliztionProdTitle"><?php echo $product\['productsName'\] . '<span class="alert bold">' . $product\['flagStockCheck'\] . '</span>'; ?></a> <?php } // EOF Personalization function ?>
Find this code:
<?php } echo '</ul>'; echo '</div>'; }
Add AFTER:
// BOF Personalization function if ($product\['personalization\_session\_key'\]) { ?> <a href="<?php echo zen\_href\_link(FILENAME\_DEFAULT, 'action=personalization\_start\_shopping\_cart&products\_id=' . $product\['id'\]); ?>" class="personalizeButton"><?php echo zen\_image\_button(BUTTON\_IMAGE\_PERSONALIZE, BUTTON\_PERSONALIZE\_ALT); ?></a> <?php } // EOF Personalization function
Before you configure your product in Zencart, you must first complete the configuration for the product on the Designer server. Once the configuration in the Designer server is complete, note down the product ID from the Designer server.
All aspects for the products such as price, weight etc. are configured in the normal way. In the page where you configure products, you will see 2 new fields. To complete the configuration in Zencart:
VirtueMart (formerly known as mambo-phpShop) is an open source e-commerce solution designed as an extension of the Joomla! content management system (CMS). VirtueMart is written in PHP and requires the MySQL database environment for storage.
VirtueMart supports an unlimited number of products and categories, with products able to be assigned to multiple categories. It also permits the sale of downloadable products, and offers a catalog mode where the shopping cart features are turned off. VirtueMart supports multiple prices for a single product, based around shopper groups or a quantity range, and permits the use of a variety of different payment gateways.
Go to Virtuemart's admin area, go to "Configuration", open "Personalization" tab and configure:
All aspects for the products such as price, weight etc. are configured in the normal way. When the Designer plugin is installed, you will see an extra item in the top menu bar with label "Personalization".
Before you configure your product in VirtueMart, you must first complete the configuration for the product on the Designer server. Once the configuration in the Designer server is complete, note down product ID from the Designer server.
To complete the configuration in VirtueMart:
After you have installed the plug-in in your VirtueMart store, you may want to confirm that the integration between your VirtueMart store and the Designer server functions correctly:
Here is the procedure to follow: