|
From: Verdon V. <ve...@us...> - 2008-12-02 19:43:24
|
Update of /cvsroot/phpwebsite-comm/modules/vshop/class In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8998/class Modified Files: vShop.php vShop_Dept.php vShop_Forms.php vShop_Item.php Log Message: 0.6.0 changes Index: vShop_Item.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop_Item.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vShop_Item.php 25 Nov 2008 15:19:30 -0000 1.1.1.1 --- vShop_Item.php 2 Dec 2008 19:43:15 -0000 1.2 *************** *** 321,325 **** } ! $links = array_merge($links, vShop::navLinks()); if($links) --- 321,327 ---- } ! if (is_array(vShop::navLinks())) { ! $links = array_merge($links, vShop::navLinks()); ! } if($links) Index: vShop_Dept.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop_Dept.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vShop_Dept.php 25 Nov 2008 15:19:29 -0000 1.1.1.1 --- vShop_Dept.php 2 Dec 2008 19:43:15 -0000 1.2 *************** *** 228,232 **** } ! $links = array_merge($links, vShop::navLinks()); if($links) --- 228,234 ---- } ! if (is_array(vShop::navLinks())) { ! $links = array_merge($links, vShop::navLinks()); ! } if($links) Index: vShop.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vShop.php 25 Nov 2008 15:19:29 -0000 1.1.1.1 --- vShop.php 2 Dec 2008 19:43:15 -0000 1.2 *************** *** 931,934 **** --- 931,952 ---- } + if (!empty($_POST['shipping_minimum'])) { + $shipping_minimum = (float)$_POST['shipping_minimum']; + if ($shipping_minimum > 0) { + PHPWS_Settings::set('vshop', 'shipping_minimum', $shipping_minimum); + } + } else { + PHPWS_Settings::reset('vshop', 'shipping_minimum'); + } + + if ( !empty($_POST['shipping_maximum']) ) { + $shipping_maximum = (float)$_POST['shipping_maximum']; + if ($shipping_maximum > 0) { + PHPWS_Settings::set('vshop', 'shipping_maximum', $shipping_maximum); + } + } else { + PHPWS_Settings::reset('vshop', 'shipping_maximum'); + } + isset($_POST['secure_checkout']) ? PHPWS_Settings::set('vshop', 'secure_checkout', 1) : *************** *** 1123,1127 **** } ! /* if shipping is by item */ if (PHPWS_Settings::get('vshop', 'shipping_calculation') == 1) { $shipping_calculation = dgettext('vshop', 'Free shipping'); --- 1141,1145 ---- } ! /* if shipping is free */ if (PHPWS_Settings::get('vshop', 'shipping_calculation') == 1) { $shipping_calculation = dgettext('vshop', 'Free shipping'); *************** *** 1145,1148 **** --- 1163,1180 ---- } + /* check for shipping min and max */ + if (PHPWS_Settings::get('vshop', 'shipping_minimum') > 0) { + if ($total_shipping < PHPWS_Settings::get('vshop', 'shipping_minimum')) { + $total_shipping = PHPWS_Settings::get('vshop', 'shipping_minimum'); + $shipping_calculation = sprintf(dgettext('vshop', 'Minimum shipping of %s'), number_format(PHPWS_Settings::get('vshop', 'shipping_minimum'), 2, '.', ',')); + } + } + if (PHPWS_Settings::get('vshop', 'shipping_maximum') > 0) { + if ($total_items > PHPWS_Settings::get('vshop', 'shipping_maximum')) { + $total_shipping = 0.00; + $shipping_calculation = sprintf(dgettext('vshop', 'Free shipping on items over %s'), number_format(PHPWS_Settings::get('vshop', 'shipping_maximum'), 2, '.', ',')); + } + } + /* add our totals to the array */ $order_array['total_items'] = $total_items; Index: vShop_Forms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop_Forms.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vShop_Forms.php 25 Nov 2008 15:19:30 -0000 1.1.1.1 --- vShop_Forms.php 2 Dec 2008 19:43:15 -0000 1.2 *************** *** 348,352 **** $form->addHidden('module', 'vshop'); $form->addHidden('aop', 'post_item'); ! $form->addHidden('dept_id', $dept->id); if ($item->id) { $this->vshop->title = sprintf(dgettext('vshop', 'Update %s item'), $dept->title); --- 348,352 ---- $form->addHidden('module', 'vshop'); $form->addHidden('aop', 'post_item'); ! if ($item->id) { $this->vshop->title = sprintf(dgettext('vshop', 'Update %s item'), $dept->title); *************** *** 358,361 **** --- 358,375 ---- } + PHPWS_Core::initModClass('vshop', 'vShop_Dept.php'); + $db = new PHPWS_DB('vshop_depts'); + $db->addColumn('id'); + $db->addColumn('title'); + $result = $db->getObjects('vShop_Dept'); + if ($result) { + foreach ($result as $dept) { + $choices[$dept->id] = $dept->title; + } + $form->addSelect('dept_id', $choices); + $form->setLabel('dept_id', dgettext('vshop', 'Department')); + $form->setMatch('dept_id', $item->dept_id); + } + $form->addText('title', $item->title); $form->setSize('title', 40); *************** *** 568,571 **** --- 582,593 ---- $form->setSize('shipping_percent', 3); + $form->addTextField('shipping_minimum', number_format(PHPWS_Settings::get('vshop', 'shipping_minimum'), 2, '.', ',')); + $form->setLabel('shipping_minimum', dgettext('vshop', 'Minimum shipping charge (0 to disable)')); + $form->setSize('shipping_minimum', 6); + + $form->addTextField('shipping_maximum', number_format(PHPWS_Settings::get('vshop', 'shipping_maximum'), 2, '.', ',')); + $form->setLabel('shipping_maximum', dgettext('vshop', 'Free shipping if total is over (0 to disable)')); + $form->setSize('shipping_maximum', 6); + $form->addMultiple('pay_methods', $pay_methods); $form->setRequired('pay_methods'); *************** *** 712,716 **** } $tpl['TOTAL_LABEL'] = dgettext('vshop', 'Total'); ! $tpl['TOTAL'] = number_format($total_items, 2, '.', ','); return PHPWS_Template::process($tpl, 'vshop', 'checkout_cart.tpl'); } --- 734,749 ---- } $tpl['TOTAL_LABEL'] = dgettext('vshop', 'Total'); ! // $tpl['TOTAL'] = number_format($total_items, 2, '.', ','); ! if (PHPWS_Settings::get('vshop', 'curr_symbol_pos') == 1) { ! $tpl['TOTAL'] = PHPWS_Settings::get('vshop', 'currency_symbol') . number_format($total_items, 2, '.', ','); ! if (PHPWS_Settings::get('vshop', 'display_currency')) { ! $tpl['TOTAL'] .= ' ' . PHPWS_Settings::get('vshop', 'currency'); ! } ! } else { ! $tpl['TOTAL'] = number_format($total_items, 2, '.', ',') . PHPWS_Settings::get('vshop', 'currency_symbol'); ! if (PHPWS_Settings::get('vshop', 'display_currency')) { ! $tpl['TOTAL'] .= ' ' . PHPWS_Settings::get('vshop', 'currency'); ! } ! } return PHPWS_Template::process($tpl, 'vshop', 'checkout_cart.tpl'); } *************** *** 868,872 **** $tpl['FINAL_LABEL'] = dgettext('vshop', 'Total Due'); ! $tpl['FINAL'] = number_format($order_data['total_grand'], 2, '.', ','); if ($formatted) { --- 901,916 ---- $tpl['FINAL_LABEL'] = dgettext('vshop', 'Total Due'); ! // $tpl['FINAL'] = number_format($order_data['total_grand'], 2, '.', ','); ! if (PHPWS_Settings::get('vshop', 'curr_symbol_pos') == 1) { ! $tpl['FINAL'] = PHPWS_Settings::get('vshop', 'currency_symbol') . number_format($order_data['total_grand'], 2, '.', ','); ! if (PHPWS_Settings::get('vshop', 'display_currency')) { ! $tpl['FINAL'] .= ' ' . PHPWS_Settings::get('vshop', 'currency'); ! } ! } else { ! $tpl['FINAL'] = number_format($order_data['total_grand'], 2, '.', ',') . PHPWS_Settings::get('vshop', 'currency_symbol'); ! if (PHPWS_Settings::get('vshop', 'display_currency')) { ! $tpl['FINAL'] .= ' ' . PHPWS_Settings::get('vshop', 'currency'); ! } ! } if ($formatted) { |