Difference between revisions of "Zen Cart"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Miscellaneous)
(Miscellaneous)
Line 14: Line 14:
  
 
== Miscellaneous ==
 
== Miscellaneous ==
 +
<pre>
 +
<code>
  
 
IS_ADMIN_FLAG
 
IS_ADMIN_FLAG
Line 28: Line 30:
  
 
$contents = array('form' => zen_draw_form('copy_to', $type_admin_handler, 'action=copy_to_confirm&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . zen_draw_hidden_field('products_id', $pInfo->products_id));
 
$contents = array('form' => zen_draw_form('copy_to', $type_admin_handler, 'action=copy_to_confirm&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . zen_draw_hidden_field('products_id', $pInfo->products_id));
 +
 +
  function zen_redirect($url, $httpResponseCode = '') {
 +
 +
init_includes \ init_cart_handler.php:
 +
<?php
 +
/**
 +
* initialise and handle cart actions
 +
* see {@link  http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
 +
*
 +
* @package initSystem
 +
* @copyright Copyright 2003-2011 Zen Cart Development Team
 +
* @copyright Portions Copyright 2003 osCommerce
 +
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 +
* @version GIT: $Id: Author: Ian Wilson  Sat Oct 6 15:06:42 2012 +0100 Modified in v1.5.2 $
 +
*/
 +
if (!defined('IS_ADMIN_FLAG')) {
 +
  die('Illegal Access');
 +
}
 +
if (isset($_GET['action'])) {
 +
  /**
 +
  * redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
 +
  */
 +
  if ($session_started == false) {
 +
    zen_redirect(zen_href_link(FILENAME_COOKIE_USAGE));
 +
  }
 +
  if (DISPLAY_CART == 'true') {
 +
    $goto =  FILENAME_SHOPPING_CART;
 +
    $parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
 +
  } else {
 +
    $chk_handler = zen_get_info_page(isset($_GET['products_id']) ? $_GET['products_id'] : 0);
 +
    $goto = $_GET['main_page'];
 +
    if ($_GET['action'] == 'buy_now') {
 +
      if (strpos($goto, 'reviews') > 5) {
 +
        $parameters = array('action');
 +
        $goto = FILENAME_PRODUCT_REVIEWS;
 +
      } else {
 +
        $parameters = array('action', 'products_id');
 +
      }
 +
    } elseif ($_GET['main_page'] == $chk_handler) {
 +
      $parameters = array('action', 'pid', 'main_page');
 +
    } else {
 +
      $parameters = array('action', 'pid', 'main_page', 'products_id');
 +
    }
 +
  }
 +
  /**
 +
  * require file containing code to handle default cart actions
 +
  */
 +
  require(DIR_WS_INCLUDES . 'main_cart_actions.php');
 +
}
 +
</code>
 +
</pre>
  
 
== See also ==
 
== See also ==

Revision as of 12:54, 13 October 2015

Zen Cart is an online shopping management system.

(TO DO: expand, organize, cross-reference, illustrate.)

See also Learning Zen Cart (1).

Description

Zen Cart 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. 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.

Miscellaneous

<code>

IS_ADMIN_FLAG

zen_admin_demo()

$type_handler = $zc_products->get_admin_handler($products->fields['products_type']);

foreach (zen_get_admin_menu_for_user() as $menuKey => $pages)

echo zen_draw_form($form_action, $type_admin_handler, 'cPath=' . $cPath . (isset($_GET['product_type']) ? '&product_type=' . $_GET['product_type'] : '') . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . '&action=' . $form_action . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'post', 'enctype="multipart/form-data"');

$pagesByMenu = zen_get_admin_pages(FALSE);

$contents = array('form' => zen_draw_form('copy_to', $type_admin_handler, 'action=copy_to_confirm&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . zen_draw_hidden_field('products_id', $pInfo->products_id));

  function zen_redirect($url, $httpResponseCode = '') {

init_includes \ init_cart_handler.php:
<?php
/**
 * initialise and handle cart actions
 * see {@link  http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
 *
 * @package initSystem
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: Ian Wilson  Sat Oct 6 15:06:42 2012 +0100 Modified in v1.5.2 $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}
if (isset($_GET['action'])) {
  /**
   * redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
   */
  if ($session_started == false) {
    zen_redirect(zen_href_link(FILENAME_COOKIE_USAGE));
  }
  if (DISPLAY_CART == 'true') {
    $goto =  FILENAME_SHOPPING_CART;
    $parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
  } else {
    $chk_handler = zen_get_info_page(isset($_GET['products_id']) ? $_GET['products_id'] : 0);
    $goto = $_GET['main_page'];
    if ($_GET['action'] == 'buy_now') {
      if (strpos($goto, 'reviews') > 5) {
        $parameters = array('action');
        $goto = FILENAME_PRODUCT_REVIEWS;
      } else {
        $parameters = array('action', 'products_id');
      }
    } elseif ($_GET['main_page'] == $chk_handler) {
      $parameters = array('action', 'pid', 'main_page');
    } else {
      $parameters = array('action', 'pid', 'main_page', 'products_id');
    }
  }
  /**
   * require file containing code to handle default cart actions
   */
  require(DIR_WS_INCLUDES . 'main_cart_actions.php');
}
</code>

See also

External links