}
            }
            if (!empty($title)) {
                $text = '<span style="white-space: nowrap;" class="hasTip" title="' . htmlentities(tsmText::_('com_tsmart_CUSTOMFLD_DIS_DER_TIP')) . '">d:' . VmHtml::checkbox('field[' . $i . '][disabler]', $customfield->disabler, $checkValue) . '</span>
							<span style="white-space: nowrap;" class="hasTip" title="' . htmlentities(tsmText::_('com_tsmart_DIS_DER_CUSTOMFLD_OVERR_DER_TIP')) . '">o:' . VmHtml::checkbox('field[' . $i . '][override]', $customfield->override, $checkValue) . '</span>';
            }
            $tables['fields'] .= '<tr class="removable">
							<td >
							<b>' . tsmText::_($type) . '</b> ' . tsmText::_($customfield->custom_title) . '</span><br/>
								' . $title . ' ' . $text . '
								<span class="vmicon vmicon-16-' . $cartIcone . '"></span>';
            if ($customfield->tsmart_product_id == $this->product->tsmart_product_id or $customfield->override != 0) {
                $tables['fields'] .= '<span class="vmicon vmicon-16-move"></span>
							<span class="vmicon vmicon-16-remove"></span>';
            }
            $tables['fields'] .= tsmartModelCustomfields::setEditCustomHidden($customfield, $i) . '</td>
							<td ' . $colspan . '>' . $customfield->display . '</td>
						 </tr>';
        }
        $i++;
    }
}
$emptyTable = '
				<tr>
					<td colspan="8">' . tsmText::_('com_tsmart_CUSTOM_NO_TYPES') . '</td>
				<tr>';
?>
			<fieldset style="background-color:#F9F9F9;">
				<legend><?php 
echo tsmText::_('com_tsmart_RELATED_CATEGORIES');
?>
Esempio n. 2
0
 function handleStockAfterStatusChangedPerProduct($newState, $oldState, $tableOrderItems, $quantity)
 {
     if ($newState == $oldState) {
         return;
     }
     // $StatutWhiteList = array('P','C','X','R','S','N');
     $db = JFactory::getDBO();
     $db->setQuery('SELECT * FROM `#__tsmart_orderstates` ');
     $StatutWhiteList = $db->loadAssocList('order_status_code');
     // new product is statut N
     $StatutWhiteList['N'] = array('order_status_id' => 0, 'order_status_code' => 'N', 'order_stock_handle' => 'A');
     if (!array_key_exists($oldState, $StatutWhiteList) or !array_key_exists($newState, $StatutWhiteList)) {
         vmError('The workflow for ' . $newState . ' or  ' . $oldState . ' is unknown, take a look on model/orders function handleStockAfterStatusChanged', 'Can\'t process workflow, contact the shopowner. Status is ' . $newState);
         return;
     }
     //vmdebug( 'updatestock qt :' , $quantity.' id :'.$productId);
     // P 	Pending
     // C 	Confirmed
     // X 	Cancelled
     // R 	Refunded
     // S 	Shipped
     // N 	New or coming from cart
     //  TO have no product setted as ordered when added to cart simply delete 'P' FROM array Reserved
     // don't set same values in the 2 arrays !!!
     // stockOut is in normal case shipped product
     //order_stock_handle
     // 'A' : stock Available
     // 'O' : stock Out
     // 'R' : stock reserved
     // the status decreasing real stock ?
     // $stockOut = array('S');
     if ($StatutWhiteList[$newState]['order_stock_handle'] == 'O') {
         $isOut = 1;
     } else {
         $isOut = 0;
     }
     if ($StatutWhiteList[$oldState]['order_stock_handle'] == 'O') {
         $wasOut = 1;
     } else {
         $wasOut = 0;
     }
     // Stock change ?
     if ($isOut && !$wasOut) {
         $product_in_stock = '-';
     } else {
         if ($wasOut && !$isOut) {
             $product_in_stock = '+';
         } else {
             $product_in_stock = '=';
         }
     }
     // the status increasing reserved stock(virtual Stock = product_in_stock - product_ordered)
     // $Reserved =  array('P','C');
     if ($StatutWhiteList[$newState]['order_stock_handle'] == 'R') {
         $isReserved = 1;
     } else {
         $isReserved = 0;
     }
     if ($StatutWhiteList[$oldState]['order_stock_handle'] == 'R') {
         $wasReserved = 1;
     } else {
         $wasReserved = 0;
     }
     if ($isReserved && !$wasReserved) {
         $product_ordered = '+';
     } else {
         if (!$isReserved && $wasReserved) {
             $product_ordered = '-';
         } else {
             $product_ordered = '=';
         }
     }
     //Here trigger plgVmGetProductStockToUpdateByCustom
     $productModel = tmsModel::getModel('product');
     if (!empty($tableOrderItems->product_attribute)) {
         if (!class_exists('tsmartModelCustomfields')) {
             require VMPATH_ADMIN . DS . 'models' . DS . 'customfields.php';
         }
         $tsmart_product_id = $tableOrderItems->tsmart_product_id;
         $product_attributes = json_decode($tableOrderItems->product_attribute, true);
         foreach ($product_attributes as $tsmart_customfield_id => $param) {
             if ($param) {
                 if (is_array($param)) {
                     reset($param);
                     $customfield_id = key($param);
                 } else {
                     $customfield_id = $param;
                 }
                 if ($customfield_id) {
                     if ($productCustom = tsmartModelCustomfields::getCustomEmbeddedProductCustomField($customfield_id)) {
                         if ($productCustom->field_type == "E") {
                             if (!class_exists('vmCustomPlugin')) {
                                 require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
                             }
                             JPluginHelper::importPlugin('vmcustom');
                             $dispatcher = JDispatcher::getInstance();
                             $dispatcher->trigger('plgVmGetProductStockToUpdateByCustom', array(&$tableOrderItems, $param, $productCustom));
                         }
                     }
                 }
             }
         }
         // we can have more then one product in case of pack
         // in case of child, ID must be the child ID
         // TO DO use $prod->amount change for packs(eg. 1 computer and 2 HDD)
         if (is_array($tableOrderItems)) {
             foreach ($tableOrderItems as $prod) {
                 $productModel->updateStockInDB($prod, $quantity, $product_in_stock, $product_ordered);
             }
         } else {
             $productModel->updateStockInDB($tableOrderItems, $quantity, $product_in_stock, $product_ordered);
         }
     } else {
         $productModel->updateStockInDB($tableOrderItems, $quantity, $product_in_stock, $product_ordered);
     }
 }
Esempio n. 3
0
 /**
  * There are too many functions doing almost the same for my taste
  * the results are sometimes slighty different and makes it hard to work with it, therefore here the function for future proxy use
  *
  */
 public static function displayProductCustomfieldSelected($product, $html, $trigger)
 {
     if (self::$customfieldRenderer) {
         self::$customfieldRenderer = false;
         if (!class_exists('VmView')) {
             require VMPATH_SITE . DS . 'helpers' . DS . 'vmview.php';
         }
         $lPath = VmView::getVmSubLayoutPath('customfield');
         if ($lPath) {
             require $lPath;
         } else {
             vmdebug('displayProductCustomfieldFE layout not found customfield');
         }
     }
     return tsmartCustomFieldRenderer::renderCustomfieldsCart($product, $html, $trigger);
 }
Esempio n. 4
0
    echo $item->order_item_name;
    ?>
</span>
					<input class='orderedit' type="text"  name="item_id[<?php 
    echo $item->tsmart_order_item_id;
    ?>
][order_item_name]" value="<?php 
    echo $item->order_item_name;
    ?>
"/><?php 
    //echo $item->order_item_name;
    //if (!empty($item->product_attribute)) {
    if (!class_exists('tsmartModelCustomfields')) {
        require VMPATH_ADMIN . DS . 'models' . DS . 'customfields.php';
    }
    $product_attribute = tsmartModelCustomfields::CustomsFieldOrderDisplay($item, 'BE');
    if ($product_attribute) {
        echo '<div>' . $product_attribute . '</div>';
    }
    //}
    $_dispatcher = JDispatcher::getInstance();
    $_returnValues = $_dispatcher->trigger('plgVmOnShowOrderLineBEShipment', array($this->orderID, $item->tsmart_order_item_id));
    $_plg = '';
    foreach ($_returnValues as $_returnValue) {
        if ($_returnValue !== null) {
            $_plg .= $_returnValue;
        }
    }
    if ($_plg !== '') {
        echo '<table border="0" celspacing="0" celpadding="0">' . '<tr>' . '<td width="8px"></td>' . '<td>' . $_plg . '</td>' . '</tr>' . '</table>';
    }