本文整理汇总了PHP中VirtueMartModelCustomfields类的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartModelCustomfields类的具体用法?PHP VirtueMartModelCustomfields怎么用?PHP VirtueMartModelCustomfields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VirtueMartModelCustomfields类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleStockAfterStatusChangedPerProduct
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 `#__virtuemart_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 = VmModel::getModel('product');
if (!empty($tableOrderItems->product_attribute)) {
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php');
$virtuemart_product_id = $tableOrderItems->virtuemart_product_id;
$product_attributes = json_decode($tableOrderItems->product_attribute,true);
foreach ($product_attributes as $virtuemart_customfield_id=>$param){
if ($param) {
if(is_array($param)){
reset($param);
$customfield_id = key($param);
} else {
$customfield_id = $param;
}
if ($customfield_id) {
if ($productCustom = VirtueMartModelCustomfields::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);
}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:90,代码来源:orders.php
示例2: store
/**
* Store a product
*
* @author Max Milbers
* @param $product given as reference
* @param bool $isChild Means not that the product is child or not. It means if the product should be threated as child
* @return bool
*/
public function store(&$product, $isChild = FALSE)
{
JRequest::checkToken() or jexit('Invalid Token');
if ($product) {
$data = (array) $product;
}
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$perm = Permissions::getInstance();
$superVendor = $perm->isSuperVendor();
if (empty($superVendor)) {
vmError('You are not a vendor or administrator, storing of product cancelled');
return FALSE;
}
if (isset($data['intnotes'])) {
$data['intnotes'] = trim($data['intnotes']);
}
// Setup some place holders
$product_data = $this->getTable('products');
if (!empty($data['virtuemart_product_id'])) {
$product_data->load($data['virtuemart_product_id']);
}
//Set the decimals like product packaging
//$decimals = array('product_length','product_width','product_height','product_weight','product_packaging');
foreach ($this->decimals as $decimal) {
if (array_key_exists($decimal, $data)) {
if (!empty($data[$decimal])) {
$data[$decimal] = str_replace(',', '.', $data[$decimal]);
} else {
$data[$decimal] = null;
$product_data->{$decimal} = null;
//vmdebug('Store product, set $decimal '.$decimal.' = null');
}
}
}
//with the true, we do preloading and preserve so old values note by Max Milbers
// $product_data->bindChecknStore ($data, $isChild);
//We prevent with this line, that someone is storing a product as its own parent
if (!empty($product_data->product_parent_id) and $product_data->product_parent_id == $data['virtuemart_product_id']) {
$product_data->product_parent_id = 0;
}
$stored = $product_data->bindChecknStore($data, false);
$errors = $product_data->getErrors();
if (!$stored or count($errors) > 0) {
foreach ($errors as $error) {
vmError('Product store ' . $error);
}
if (!$stored) {
vmError('You are not an administrator or the correct vendor, storing of product cancelled');
}
return FALSE;
}
$this->_id = $data['virtuemart_product_id'] = (int) $product_data->virtuemart_product_id;
if (empty($this->_id)) {
vmError('Product not stored, no id');
return FALSE;
}
//We may need to change this, the reason it is not in the other list of commands for parents
if (!$isChild) {
if (!empty($data['save_customfields'])) {
if (!class_exists('VirtueMartModelCustomfields')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php';
}
VirtueMartModelCustomfields::storeProductCustomfields('product', $data, $product_data->virtuemart_product_id);
}
}
// Get old IDS
$old_price_ids = $this->loadProductPrices($this->_id, 0, 0, false);
//vmdebug('$old_price_ids ',$old_price_ids);
if (isset($data['mprices']['product_price']) and count($data['mprices']['product_price']) > 0) {
foreach ($data['mprices']['product_price'] as $k => $product_price) {
$pricesToStore = array();
$pricesToStore['virtuemart_product_id'] = $this->_id;
$pricesToStore['virtuemart_product_price_id'] = (int) $data['mprices']['virtuemart_product_price_id'][$k];
if (!$isChild) {
//$pricesToStore['basePrice'] = $data['mprices']['basePrice'][$k];
$pricesToStore['product_override_price'] = $data['mprices']['product_override_price'][$k];
$pricesToStore['override'] = (int) $data['mprices']['override'][$k];
$pricesToStore['virtuemart_shoppergroup_id'] = (int) $data['mprices']['virtuemart_shoppergroup_id'][$k];
$pricesToStore['product_tax_id'] = (int) $data['mprices']['product_tax_id'][$k];
$pricesToStore['product_discount_id'] = (int) $data['mprices']['product_discount_id'][$k];
$pricesToStore['product_currency'] = (int) $data['mprices']['product_currency'][$k];
$pricesToStore['product_price_publish_up'] = $data['mprices']['product_price_publish_up'][$k];
$pricesToStore['product_price_publish_down'] = $data['mprices']['product_price_publish_down'][$k];
$pricesToStore['price_quantity_start'] = (int) $data['mprices']['price_quantity_start'][$k];
$pricesToStore['price_quantity_end'] = (int) $data['mprices']['price_quantity_end'][$k];
}
if (!$isChild and isset($data['mprices']['use_desired_price'][$k]) and $data['mprices']['use_desired_price'][$k] == "1") {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
//.........这里部分代码省略.........
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:101,代码来源:product.php
示例3: retornaHtmlPagamento
//.........这里部分代码省略.........
} elseif (stripos($envio, "sedex") !== false) {
$tipo_frete = "SD";
} else {
$tipo_frete = "EN";
}
*/
// configuração dos campos
$campo_complemento = $method->campo_complemento;
$campo_numero = $method->campo_numero;
$html .= '<form id="frm_pagseguro" action="https://pagseguro.uol.com.br/v2/checkout/payment.html" method="post" > ';
$html .= ' <input type="hidden" name="receiverEmail" value="' . $method->email_cobranca . '" />
<input type="hidden" name="currency" value="BRL" />
<input type="hidden" name="tipo" value="CP" />
<input type="hidden" name="encoding" value="utf-8" />';
if (isset($order["details"][$endereco]) and isset($order["details"][$endereco]->{$campo_complemento})) {
$complemento = $order["details"][$endereco]->{$campo_complemento};
} else {
$complemento = '';
}
if (isset($order["details"][$endereco]) and isset($order["details"][$endereco]->{$campo_numero})) {
$numero = $order["details"][$endereco]->{$campo_numero};
} else {
$numero = '';
}
$html .= '<input name="reference" type="hidden" value="' . ($order["details"][$endereco]->order_number != '' ? $order["details"][$endereco]->order_number : $order["details"]["BT"]->order_number) . '">';
$html .= '<input type="hidden" name="senderName" value="' . ($order["details"][$endereco]->first_name != '' ? $order["details"][$endereco]->first_name : $order["details"]["BT"]->first_name) . ' ' . ($order["details"][$endereco]->last_name != '' ? $order["details"][$endereco]->last_name : $order["details"]["BT"]->last_name) . '" />
<input type="hidden" name="shippingType" value="' . $method->tipo_frete . '" />
<input type="hidden" name="shippingAddressPostalCode" value="' . ($order["details"][$endereco]->zip != '' ? $order["details"][$endereco]->zip : $order["details"]["BT"]->zip) . '" />
<input type="hidden" name="shippingAddressStreet" value="' . ($order["details"][$endereco]->address_1 != '' ? $order["details"][$endereco]->address_1 : $order["details"]["BT"]->address_1) . ' ' . ($order["details"][$endereco]->address_2 != '' ? $order["details"][$endereco]->address_2 : $order["details"]["BT"]->address_2) . '" />
<input type="hidden" name="shippingAddressNumber" value="' . $numero . '" />
<input type="hidden" name="shippingAddressComplement" value="' . $complemento . '" />
<input type="hidden" name="shippingAddressCity" value="' . ($order["details"][$endereco]->city != '' ? $order["details"][$endereco]->city : $order["details"]["BT"]->city) . '" />';
$cod_estado = !empty($order["details"][$endereco]->virtuemart_state_id) ? $order["details"][$endereco]->virtuemart_state_id : $order["details"]["BT"]->virtuemart_state_id;
$estado = ShopFunctions::getStateByID($cod_estado, "state_2_code");
$html .= '
<input type="hidden" name="shippingAddressState" value="' . $estado . '" />
<input type="hidden" name="shippingAddressCountry" value="BRA" />
<input type="hidden" name="senderAreaCode" value="" />
<input type="hidden" name="senderPhone" value="' . ($order["details"][$endereco]->phone_1 != '' ? $order["details"][$endereco]->phone_1 : $order["details"]["BT"]->phone_1) . '" />
<input type="hidden" name="senderEmail" value="' . ($order["details"][$endereco]->email != '' ? $order["details"][$endereco]->email : $order["details"]["BT"]->email) . '" />';
// total do frete
// configurado para passar o frete do total da compra
if (!empty($order["details"]["BT"]->order_shipment)) {
$html .= '<input type="hidden" name="itemShippingCost1" value="' . number_format(round($order["details"][$endereco]->order_shipment != '' ? $order["details"][$endereco]->order_shipment : $order["details"]["BT"]->order_shipment, 2), 2, '.', '') . '">';
} else {
$html .= '<input type="hidden" name="itemShippingCost1" value="0">';
}
// desconto do pedido
/*
$order_discount = (float)$order["details"]["BT"]->order_discount;
if (empty($order_discount) && (!empty($order["details"]["BT"]->coupon_discount))) {
$order_discount = (float)$order["details"]["BT"]->coupon_discount;
}
$order_discount = (-1)*abs($order_discount);
if (!empty($order_discount)) {
$html .= '<input type="hidden" name="extraAmount" value="'.number_format($order_discount,2,'.','').'" />';
}
*/
// Cupom de Desconto
$desconto_pedido = $order["details"]['BT']->coupon_discount;
//$desconto_pedido*= -1;
$html .= '<input type="hidden" name="extras" value="' . number_format($desconto_pedido, 2, ",", "") . '" />';
$order_subtotal = $order['details']['BT']->order_subtotal;
if (!class_exists('VirtueMartModelCustomfields')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php';
}
if (!class_exists('VirtueMartModelProduct')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php';
}
$i = 0;
$product_model = VmModel::getModel('product');
foreach ($order['items'] as $p) {
$i++;
$valor_produto = $p->product_final_price;
// desconto do pedido
$valor_item = $valor_produto;
$pr = $product_model->getProduct($p->virtuemart_product_id);
$product_attribute = strip_tags(VirtueMartModelCustomfields::CustomsFieldOrderDisplay($p, 'FE'));
$html .= '<input type="hidden" name="itemId' . $i . '" value="' . $p->virtuemart_order_item_id . '">
<input type="hidden" name="itemDescription' . $i . '" value="' . $p->order_item_name . '">
<input type="hidden" name="itemQuantity' . $i . '" value="' . $p->product_quantity . '">
<input type="hidden" name="itemAmount' . $i . '" value="' . number_format(round($p->product_final_price, 2), 2, '.', '') . '">
<input type="hidden" name="itemWeight' . $i . '" value="1">';
/* <input type="hidden" name="itemWeight' . $i . '" value="' .round( ShopFunctions::convertWeigthUnit($pr->product_weight, $pr->product_weight_uom, "GR"),2) . '"> */
}
$url = JURI::root();
$url_lib = $url . DS . 'plugins' . DS . 'vmpayment' . DS . 'pagseguro_virtuemartbrasil' . DS;
$url_imagem_pagamento = $url_lib . 'imagens' . DS . 'pagseguro.gif';
// segundos para redirecionar para o Pagseguro
if ($redir) {
// segundos para redirecionar para o Pagseguro
$segundos = $method->segundos_redirecionar;
$html .= '<br/><br/>Você será direcionado para a tela de pagamento em ' . $segundos . ' segundo(s), ou então clique logo abaixo:<br />';
$html .= '<script>setTimeout(\'document.getElementById("frm_pagseguro").submit();\',' . $segundos . '000);</script>';
}
$html .= '<div align="center"><br /><input type="image" value="Clique aqui para efetuar o pagamento" src="' . $url_imagem_pagamento . '" /></div>';
$html .= '</form>';
return $html;
}
开发者ID:rurikhero,项目名称:PagSeguro-VirtueMart-3,代码行数:101,代码来源:pagseguro_virtuemartbrasil.php
示例4:
<td ><span class="vmicon vmicon-16-move"></span></td>
</tr>';
/*$tables['fields'] .= '
<tr class="removable">
<td>'.JText::_($customfield->custom_title).'</td>
<td colspan="3"><span>'.$customfield->display.$customfield->custom_tip.'</span>'.
VirtueMartModelCustomfields::setEditCustomHidden($customfield, $i)
.'</td><span class="vmicon icon-nofloat vmicon-16-'.$cartIcone.'"></span>
<span class="vmicon vmicon-16-remove"></span>
</tr>';*/
} else {
$tables['fields'] .= '<tr class="removable">
<td>' . JText::_($customfield->custom_title) . '</td>
<td>' . $customfield->custom_tip . '</td>
<td>' . $customfield->display . '</td>
<td>' . JText::_($this->fieldTypes[$customfield->field_type]) . VirtueMartModelCustomfields::setEditCustomHidden($customfield, $i) . '</td>
<td>
<span class="vmicon vmicon-16-' . $cartIcone . '"></span>
</td>
<td><span class="vmicon vmicon-16-remove"></span><input class="ordering" type="hidden" value="' . $customfield->ordering . '" name="field[' . $i . '][ordering]" /></td>
<td ><span class="vmicon vmicon-16-move"></span></td>
</tr>';
}
$i++;
}
}
$emptyTable = '
<tr>
<td colspan="8">' . JText::_('COM_VIRTUEMART_CUSTOM_NO_TYPES') . '</td>
<tr>';
?>
开发者ID:Roma48,项目名称:abazherka_old,代码行数:31,代码来源:product_edit_custom.php
示例5: prepareAjaxData
function prepareAjaxData($checkAutomaticSelected = true)
{
$this->prepareCartData(false);
$data = new stdClass();
$data->products = array();
$data->totalProduct = 0;
//OSP when prices removed needed to format billTotal for AJAX
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currencyDisplay = CurrencyDisplay::getInstance();
foreach ($this->products as $i => $product) {
$category_id = $this->getCardCategoryId($product->virtuemart_product_id);
//Create product URL
$url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $category_id, FALSE);
$data->products[$i]['product_name'] = JHtml::link($url, $product->product_name);
if (!class_exists('VirtueMartModelCustomfields')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'customfields.php';
}
// custom product fields display for cart
$data->products[$i]['customProductData'] = VirtueMartModelCustomfields::CustomsFieldCartModDisplay($product);
$data->products[$i]['product_sku'] = $product->product_sku;
$data->products[$i]['prices'] = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['subtotal']);
// other possible option to use for display
$data->products[$i]['subtotal'] = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['subtotal']);
$data->products[$i]['subtotal_tax_amount'] = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['subtotal_tax_amount']);
$data->products[$i]['subtotal_discount'] = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['subtotal_discount']);
$data->products[$i]['subtotal_with_tax'] = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['subtotal_with_tax']);
// UPDATE CART / DELETE FROM CART
$data->products[$i]['quantity'] = $product->quantity;
$data->totalProduct += $product->quantity;
}
if (empty($this->cartPrices['billTotal']) or $this->cartPrices['billTotal'] < 0) {
$this->cartPrices['billTotal'] = 0.0;
}
$data->billTotal = $currencyDisplay->priceDisplay($this->cartPrices['billTotal']);
$data->dataValidated = $this->_dataValidated;
if ($data->totalProduct > 1) {
$data->totalProductTxt = vmText::sprintf('COM_VIRTUEMART_CART_X_PRODUCTS', $data->totalProduct);
} else {
if ($data->totalProduct == 1) {
$data->totalProductTxt = vmText::_('COM_VIRTUEMART_CART_ONE_PRODUCT');
} else {
$data->totalProductTxt = vmText::_('COM_VIRTUEMART_EMPTY_CART');
}
}
if (false && $data->dataValidated == true) {
$taskRoute = '&task=confirm';
$linkName = vmText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU');
} else {
$taskRoute = '';
$linkName = vmText::_('COM_VIRTUEMART_CART_SHOW');
}
$data->cart_show = '<a style ="float:right;" href="' . JRoute::_("index.php?option=com_virtuemart&view=cart" . $taskRoute, $this->useSSL) . '" rel="nofollow" >' . $linkName . '</a>';
$data->billTotal = vmText::sprintf('COM_VIRTUEMART_CART_TOTALP', $data->billTotal);
return $data;
}
开发者ID:chaudhary4k4,项目名称:modernstore,代码行数:57,代码来源:cart.php
示例6: array
echo $item->order_item_name;
?>
</span>
<input class='orderedit' type="text" name="item_id[<?php
echo $item->virtuemart_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('VirtueMartModelCustomfields')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'customfields.php';
}
$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item, 'BE');
if ($product_attribute) {
echo '<div>' . $product_attribute . '</div>';
}
//}
$_dispatcher = JDispatcher::getInstance();
$_returnValues = $_dispatcher->trigger('plgVmOnShowOrderLineBEShipment', array($this->orderID, $item->virtuemart_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>';
}
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:31,代码来源:order.php
示例7: displayProductCustomfieldFE
/**
* Formating front display by roles
* for product only !
*/
public function displayProductCustomfieldFE(&$product, $customfield, $row = '')
{
$virtuemart_custom_id = isset($customfield->virtuemart_custom_id) ? $customfield->virtuemart_custom_id : 0;
$value = $customfield->custom_value;
$type = $customfield->field_type;
$is_list = isset($customfield->is_list) ? $customfield->is_list : 0;
$price = isset($customfield->custom_price) ? $customfield->custom_price : 0;
$is_cart = isset($customfield->is_cart) ? $customfield->is_cart : 0;
//vmdebug('displayProductCustomfieldFE and here is something wrong ',$customfield);
JLoader::register('CurrencyDisplay', JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php');
$currency = CurrencyDisplay::getInstance();
if ($is_list > 0) {
$values = explode(';', $value);
if ($is_cart != 0) {
$options = array();
foreach ($values as $key => $val) {
$options[] = array('value' => $val, 'text' => $val);
}
// J3 use chosen vmJsApi::chosenDropDowns();
return JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', NULL, 'value', 'text', FALSE, TRUE);
} else {
$html = '';
$html .= '<div id="custom_' . $virtuemart_custom_id . '_' . $value . '" >' . $value . '</div>';
return $html;
}
} else {
if ($price > 0) {
$price = $currency->priceDisplay((double) $price);
}
switch ($type) {
case 'A':
$options = array();
$session = JFactory::getSession();
$virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
$productModel = VmModel::getModel('product');
//parseCustomParams
VirtueMartModelCustomfields::bindParameterableByFieldType($customfield);
//Todo preselection as dropdown of children
//Note by Max Milbers: This is not necessary, in this case it is better to unpublish the parent and to give the child which should be preselected a category
//Or it is withParent, in that case there exists the case, that a parent should be used as a kind of mini category and not be orderable.
//There exists already other customs and in special plugins which wanna disable or change the add to cart button.
//I suggest that we manipulate the button with a message "choose a variant first"
//if(!isset($customfield->pre_selected)) $customfield->pre_selected = 0;
$selected = JRequest::getVar('virtuemart_product_id', 0);
if (is_array($selected)) {
$selected = $selected[0];
}
$selected = (int) $selected;
$html = '';
$uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
if (empty($uncatChildren)) {
return $html;
break;
}
foreach ($uncatChildren as $k => $child) {
$options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child['product_name']);
}
$html .= JHTML::_('select.genericlist', $options, 'field[' . $row . '][custom_value]', 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="inputbox"', "value", "text", JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected, 'cf' . $row . '-' . $selected));
//vmdebug('$customfield',$customfield);
if ($customfield->parentOrderable == 0 and $product->product_parent_id == 0) {
$product->orderable = FALSE;
}
return $html;
break;
/* variants*/
/* variants*/
case 'V':
if ($price == 0) {
$price = JText::_('COM_VIRTUEMART_CART_PRICE_FREE');
}
/* Loads the product price details */
return '<input type="text" value="' . JText::_($value) . '" name="field[' . $row . '][custom_value]" /> ' . JText::_('COM_VIRTUEMART_CART_PRICE') . $price . ' ';
break;
/*Date variant*/
/*Date variant*/
case 'D':
return '<span class="product_custom_date">' . vmJsApi::date($value, 'LC1', TRUE) . '</span>';
//vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
break;
/* text area or editor No JText, only displayed in BE */
/* text area or editor No JText, only displayed in BE */
case 'X':
case 'Y':
return $value;
break;
/* string or integer */
/* string or integer */
case 'S':
case 'I':
return JText::_($value);
break;
/* bool */
/* bool */
case 'B':
if ($value == 0) {
return JText::_('COM_VIRTUEMART_NO');
//.........这里部分代码省略.........
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:101,代码来源:customfields.php
示例8: renderCustomfieldsFE
//.........这里部分代码省略.........
if (!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) {
$dropdowns[$k] = array();
}
if (!in_array($variant, $dropdowns[$k])) {
if ($k == 0 or !$productSelection) {
$dropdowns[$k][] = $variant;
} else {
if ($k > 0 and $productSelection[$k - 1] == $variants[$k - 1]) {
$break = false;
for ($h = 1; $h <= $k; $h++) {
if ($productSelection[$h - 1] != $variants[$h - 1]) {
//$ignore[] = $variant;
$break = true;
}
}
if (!$break) {
$dropdowns[$k][] = $variant;
}
} else {
// break;
}
}
}
}
}
$tags = array();
foreach ($customfield->selectoptions as $k => $soption) {
$options = array();
$selected = false;
if (isset($dropdowns[$k])) {
foreach ($dropdowns[$k] as $i => $elem) {
$elem = trim((string) $elem);
$text = $elem;
if ($soption->clabel != '' and in_array($soption->voption, VirtueMartModelCustomfields::$dimensions)) {
$rd = $soption->clabel;
if (is_numeric($rd) and is_numeric($elem)) {
$text = number_format(round((double) $elem, (int) $rd), $rd);
}
//vmdebug('($dropdowns[$k] in DIMENSION value = '.$elem.' r='.$rd.' '.$text);
} else {
if ($soption->voption === 'clabels' and $soption->clabel != '') {
$text = tsmText::_($elem);
}
}
if (empty($elem)) {
$text = tsmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION');
}
$options[] = array('value' => $elem, 'text' => $text);
if ($productSelection and $productSelection[$k] == $elem) {
$selected = $elem;
}
}
}
if (empty($selected)) {
$product->orderable = false;
}
$idTagK = $idTag . 'cvard' . $k;
if ($customfield->showlabels) {
if (in_array($soption->voption, VirtueMartModelCustomfields::$dimensions)) {
$soption->slabel = tsmText::_('COM_VIRTUEMART_' . strtoupper($soption->voption));
} else {
if (!empty($soption->clabel) and !in_array($soption->voption, VirtueMartModelCustomfields::$dimensions)) {
$soption->slabel = tsmText::_($soption->clabel);
}
}
if (isset($soption->slabel)) {
开发者ID:cuongnd,项目名称:etravelservice,代码行数:67,代码来源:customfield.php
示例9: foreach
foreach ($product->customfields as $customRow) {
?>
<?php
if ($customRow->field_type == 'E') {
?>
<fieldset class="removable">
<legend><?php
echo JText::_($customRow->custom_title);
?>
</legend>
<span><?php
echo $customRow->display . $customRow->custom_tip;
?>
</span>
<?php
echo VirtueMartModelCustomfields::setEditCustomHidden($customRow, $i);
?>
<span class="vmicon icon-nofloat vmicon-16-<?php
echo $customRow->is_cart_attribute ? 'default' : 'default-off';
?>
"></span>
<span class="vmicon vmicon-16-remove"></span>
</fieldset>
<?php
}
?>
<?php
$i++;
}
?>
</div>
开发者ID:Gskflute,项目名称:joomla25,代码行数:31,代码来源:form.php
示例10: store
/**
* Store a product
*
* @author RolandD
* @author Max Milbers
* @access public
*/
public function store(&$product, $isChild = FALSE)
{
JRequest::checkToken() or jexit('Invalid Token');
if ($product) {
$data = (array) $product;
}
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$perm = Permissions::getInstance();
$superVendor = $perm->isSuperVendor();
if (empty($superVendor)) {
vmError('You are not a vendor or administrator, storing of product cancelled');
return FALSE;
}
if (isset($data['intnotes'])) {
$data['intnotes'] = trim($data['intnotes']);
}
// Setup some place holders
$product_data = $this->getTable('products');
//Set the product packaging
if (array_key_exists('product_packaging', $data)) {
$data['product_packaging'] = str_replace(',', '.', $data['product_packaging']);
}
//with the true, we do preloading and preserve so old values note by Max Milbers
// $product_data->bindChecknStore ($data, $isChild);
$stored = $product_data->bindChecknStore($data, TRUE);
$errors = $product_data->getErrors();
if (!$stored or count($errors) > 0) {
foreach ($errors as $error) {
vmError('Product store ' . $error);
}
if (!$stored) {
vmError('You are not an administrator or the correct vendor, storing of product cancelled');
}
return FALSE;
}
$this->_id = $data['virtuemart_product_id'] = $product_data->virtuemart_product_id;
if (empty($this->_id)) {
vmError('Product not stored, no id');
return FALSE;
}
//We may need to change this, the reason it is not in the other list of commands for parents
if (!$isChild) {
if (!empty($data['save_customfields'])) {
if (!class_exists('VirtueMartModelCustomfields')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php';
}
VirtueMartModelCustomfields::storeProductCustomfields('product', $data, $product_data->virtuemart_product_id);
}
}
//vmdebug('use_desired_price '.$this->_id.' '.$data['use_desired_price']);
if (!$isChild and isset($data['use_desired_price']) and $data['use_desired_price'] == "1") {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
$calculator = calculationHelper::getInstance();
$data['product_price'] = $calculator->calculateCostprice($this->_id, $data);
unset($data['use_desired_price']);
// vmdebug('product_price '.$data['product_price']);
}
if (isset($data['product_price'])) {
if ($isChild) {
unset($data['product_override_price']);
unset($data['override']);
}
$data = $this->updateXrefAndChildTables($data, 'product_prices');
}
if (!empty($data['childs'])) {
foreach ($data['childs'] as $productId => $child) {
$child['product_parent_id'] = $data['virtuemart_product_id'];
$child['virtuemart_product_id'] = $productId;
$this->store($child, TRUE);
}
}
if (!$isChild) {
$data = $this->updateXrefAndChildTables($data, 'product_shoppergroups');
$data = $this->updateXrefAndChildTables($data, 'product_manufacturers');
if (!empty($data['categories']) && count($data['categories']) > 0) {
$data['virtuemart_category_id'] = $data['categories'];
} else {
$data['virtuemart_category_id'] = array();
}
$data = $this->updateXrefAndChildTables($data, 'product_categories', TRUE);
// Update waiting list
//TODO what is this doing?
if (!empty($data['notify_users'])) {
if ($data['product_in_stock'] > 0 && $data['notify_users'] == '1') {
$waitinglist = VmModel::getModel('Waitinglist');
$waitinglist->notifyList($data['virtuemart_product_id']);
}
}
// Process the images
//.........这里部分代码省略.........
开发者ID:alesconti,项目名称:FF_2015,代码行数:101,代码来源:product.php
示例11: array
<?php
echo Jtext::_('COM_VIRTUEMART_PRODUCT_ADD_CHILD');
?>
</a>
</div>
</div>
</td>
<td width="29%"><div style="text-align:right; font-weight: bold;">
<?php
echo JText::_('COM_VIRTUEMART_PRODUCT_FORM_PARENT');
?>
</td>
<td width="71%"> <?php
if ($this->product->product_parent_id) {
$parentRelation = VirtueMartModelCustomfields::getProductParentRelation($this->product->virtuemart_product_id);
$result = JText::_('COM_VIRTUEMART_EDIT') . ' ' . $this->product_parent->product_name;
echo ' | ' . JHTML::_('link', JRoute::_('index.php?view=product&task=edit&virtuemart_product_id=' . $this->product->product_parent_id . '&option=com_virtuemart'), $this->product_parent->product_name, array('title' => $result)) . ' | ' . $parentRelation;
}
?>
</td>
</tr>
<?php
$i = 1 - $i;
?>
<tr class="row<?php
echo $i;
?>
开发者ID:joselapria,项目名称:virtuemart,代码行数:31,代码来源:product_edit_information.php
示例12: store
/**
* Store a product
*
* @author RolandD
* @author Max Milbers
* @access public
*/
public function store(&$product, $isChild = FALSE)
{
JRequest::checkToken() or jexit('Invalid Token');
if ($product) {
$data = (array) $product;
}
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$perm = Permissions::getInstance();
$superVendor = $perm->isSuperVendor();
if (empty($superVendor)) {
vmError('You are not a vendor or administrator, storing of product cancelled');
return FALSE;
}
if (isset($data['intnotes'])) {
$data['intnotes'] = trim($data['intnotes']);
}
// Setup some place holders
$product_data = $this->getTable('products');
//Set the product packaging
if (array_key_exists('product_packaging', $data)) {
$data['product_packaging'] = str_replace(',', '.', $data['product_packaging']);
}
//with the true, we do preloading and preserve so old values note by Max Milbers
// $product_data->bindChecknStore ($data, $isChild);
$stored = $product_data->bindChecknStore($data, TRUE);
$errors = $product_data->getErrors();
if (!$stored or count($errors) > 0) {
foreach ($errors as $error) {
vmError('Product store ' . $error);
}
if (!$stored) {
vmError('You are not an administrator or the correct vendor, storing of product cancelled');
}
return FALSE;
}
$this->_id = $data['virtuemart_product_id'] = (int) $product_data->virtuemart_product_id;
if (empty($this->_id)) {
vmError('Product not stored, no id');
return FALSE;
}
//We may need to change this, the reason it is not in the other list of commands for parents
if (!$isChild) {
if (!empty($data['save_customfields'])) {
if (!class_exists('VirtueMartModelCustomfields')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php';
}
VirtueMartModelCustomfields::storeProductCustomfields('product', $data, $product_data->virtuemart_product_id);
}
}
// Get old IDS
$this->_db->setQuery('SELECT `virtuemart_product_price_id` FROM `#__virtuemart_product_prices` WHERE virtuemart_product_id =' . $this->_id);
$old_price_ids = $this->_db->loadResultArray();
foreach ($data['mprices']['product_price'] as $k => $product_price) {
$pricesToStore = array();
$pricesToStore['virtuemart_product_id'] = $this->_id;
$pricesToStore['virtuemart_product_price_id'] = (int) $data['mprices']['virtuemart_product_price_id'][$k];
if (!$isChild) {
//$pricesToStore['basePrice'] = $data['mprices']['basePrice'][$k];
$pricesToStore['product_override_price'] = $data['mprices']['product_override_price'][$k];
$pricesToStore['override'] = (int) $data['mprices']['override'][$k];
$pricesToStore['virtuemart_shoppergroup_id'] = (int) $data['mprices']['virtuemart_shoppergroup_id'][$k];
$pricesToStore['product_tax_id'] = (int) $data['mprices']['product_tax_id'][$k];
$pricesToStore['product_discount_id'] = (int) $data['mprices']['product_discount_id'][$k];
$pricesToStore['product_currency'] = (int) $data['mprices']['product_currency'][$k];
$pricesToStore['product_price_publish_up'] = $data['mprices']['product_price_publish_up'][$k];
$pricesToStore['product_price_publish_down'] = $data['mprices']['product_price_publish_down'][$k];
$pricesToStore['price_quantity_start'] = (int) $data['mprices']['price_quantity_start'][$k];
$pricesToStore['price_quantity_end'] = (int) $data['mprices']['price_quantity_end'][$k];
}
if (!$isChild and isset($data['mprices']['use_desired_price'][$k]) and $data['mprices']['use_desired_price'][$k] == "1") {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
$calculator = calculationHelper::getInstance();
$pricesToStore['salesPrice'] = $data['mprices']['salesPrice'][$k];
$pricesToStore['product_price'] = $data['mprices']['product_price'][$k] = $calculator->calculateCostprice($this->_id, $pricesToStore);
unset($data['mprices']['use_desired_price'][$k]);
} else {
$pricesToStore['product_price'] = $data['mprices']['product_price'][$k];
}
if (isset($data['mprices']['product_price'][$k])) {
if ($isChild) {
unset($data['mprices']['product_override_price'][$k]);
unset($pricesToStore['product_override_price']);
unset($data['mprices']['override'][$k]);
unset($pricesToStore['override']);
}
//$data['mprices'][$k] = $data['virtuemart_product_id'];
$this->updateXrefAndChildTables($pricesToStore, 'product_prices', $isChild);
$key = array_search($pricesToStore['virtuemart_product_price_id'], $
|
请发表评论