本文整理汇总了PHP中comquick2cartHelper::saveProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP comquick2cartHelper::saveProduct方法的具体用法?PHP comquick2cartHelper::saveProduct怎么用?PHP comquick2cartHelper::saveProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comquick2cartHelper
的用法示例。
在下文中一共展示了comquick2cartHelper::saveProduct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addcurrency
function addcurrency()
{
$jinput = JFactory::getApplication()->input;
$cur_post = $jinput->post;
$item_name = $jinput->get('item_name', '', 'STRING');
$multi_cur = $cur_post->get('multi_cur', array(), 'ARRAY');
$attdata = $cur_post->get('attdata', array(), 'ARRAY');
$data = array();
$originalCount = count($multi_cur);
$filtered_curr = array_filter($multi_cur, 'strlen');
// remove empty currencies from multi_curr
$filter_count = count($filtered_curr);
if ($item_name && $originalCount == $filter_count) {
$model = $this->getModel('attributes');
$comquick2cartHelper = new comquick2cartHelper();
$result = $comquick2cartHelper->saveProduct($cur_post);
if ($result && !is_numeric($result)) {
$data = array('0' => '0', '1' => JText::_('QTC_OPTIONS_NOT_SAVE', true));
} else {
$data = array('0' => '1', '1' => JText::_('COM_QUICK2CART_ITEM_SAVED_SUCCESSFULLY', true));
}
} else {
$data = array('0' => '0', '1' => JText::_('QTC_OPTIONS_REQUIRED'));
}
echo json_encode($data);
jexit();
}
示例2: save
function save($saveClose = 0)
{
$jinput = JFactory::getApplication()->input;
$cur_post = $jinput->post;
$sku = $cur_post->get('sku', '', "RAW");
$sku = trim($sku);
global $mainframe;
$mainframe = JFactory::getApplication();
$current_store = $cur_post->get('current_store');
if (!empty($current_store)) {
$mainframe->setUserState('current_store', $current_store);
}
$item_name = $jinput->get('item_name', '', 'STRING');
//$currencydata = $cur_post['multi_cur'];
$pid = $jinput->get('pid', 0, 'INT');
$client = 'com_quick2cart';
$stock = $jinput->get('itemstock', '', 'INTEGER');
$min_qty = $jinput->get('min_item');
$max_qty = $jinput->get('max_item');
$cat = $jinput->get('prod_cat', '', 'INTEGER');
//$sku=$jinput->get('sku');
$params = JComponentHelper::getParams('com_quick2cart');
$on_editor = $params->get('enable_editor', 0);
$youtubleLink = $jinput->get('youtube_link', '', "RAW");
$store_id = $jinput->get('current_store');
//1; // @TODO hard coded for now store // @if store id is empty then calculate from item_id
$data = array();
//get currency field count
$multi_curArray = $cur_post->get('multi_cur', array(), 'ARRAY');
$originalCount = count($multi_curArray);
$filtered_curr = array_filter($multi_curArray, 'strlen');
// remove empty currencies from multi_curr
//get currency field count after filter enpty allow 0
$filter_count = count($filtered_curr);
if ($item_name && $originalCount == $filter_count) {
//load Attributes model
$comquick2cartHelper = new comquick2cartHelper();
$path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'attributes.php';
$attri_model = $comquick2cartHelper->loadqtcClass($path, "quick2cartModelAttributes");
$cur_post->set('saveAttri', 1);
// whether have to save attributes or not
$cur_post->set('saveMedia', 1);
$item_id = $comquick2cartHelper->saveProduct($cur_post);
if (is_numeric($item_id)) {
//load product model
$path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'product.php';
$prodmodel = $comquick2cartHelper->loadqtcClass($path, 'quick2cartModelProduct');
if ($saveClose == 1) {
return 1;
}
$mainframe->setUserState('item_id', $item_id);
$this->setRedirect(JUri::base() . "index.php?option=com_quick2cart&view=products&layout=new&item_id=" . $item_id, JText::_('COM_QUICK2CART_SAVE_SUCCESS'));
} else {
//save attribute if any $msg = JText::_( 'C_SAVE_M_NS' );
$this->setRedirect(JUri::base() . "index.php?option=com_quick2cart&view=products&layout=new", JText::_('C_SAVE_M_NS'));
}
} else {
$this->setRedirect(JUri::base() . "index.php?option=com_quick2cart&view=products&layout=new", JText::_('C_FILL_COMPULSORY_FIELDS'));
}
}
示例3: save
function save($saveClose = 0)
{
$params = JComponentHelper::getParams('com_quick2cart');
$app = JFactory::getApplication();
$jinput = $app->input;
$cur_post = $jinput->post;
$sku = $cur_post->get('sku', '', "RAW");
$sku = trim($sku);
$current_store = $cur_post->get('current_store');
if (!empty($current_store)) {
$app->setUserState('current_store', $current_store);
}
$item_name = $jinput->get('item_name', '', 'STRING');
// $currencydata = $cur_post['multi_cur'];
$pid = $jinput->get('pid', 0, 'INT');
$client = 'com_quick2cart';
$stock = $jinput->get('stock', '', 'INTEGER');
$min_qty = $jinput->get('min_item');
$max_qty = $jinput->get('max_item');
$cat = $jinput->get('prod_cat', '', 'INTEGER');
//$sku = $jinput->get('sku');
$on_editor = $params->get('enable_editor', 0);
if (empty($on_editor)) {
$des = $jinput->get('description', '', 'STRING');
} else {
$des_data = $jinput->get('description', array(), "ARRAY");
$des = $des_data["data"];
}
$youtubleLink = $jinput->get('youtube_link', '', "RAW");
$store_id = $jinput->get('store_id');
$data = array();
// Get currency field count
$multi_curArray = $cur_post->get('multi_cur', array(), 'ARRAY');
$originalCount = count($multi_curArray);
// Remove empty currencies from multi_curr
$filtered_curr = array_filter($multi_curArray, 'strlen');
// Get currency field count after filter empty allow 0
$filter_count = count($filtered_curr);
if ($item_name && $originalCount == $filter_count) {
$model = $this->getModel('attributes');
//@TODO REMOVE ALL PARAMETER AND SEND FORMATEED POST DATEA
$comquick2cartHelper = new comquick2cartHelper();
$cur_post->set('saveAttri', 1);
// whether have to save attributes or not
$cur_post->set('saveMedia', 1);
//$item_id = $comquick2cartHelper->saveProduct($pid,$client,$current_store,$item_name,$cur_post,$stock,$min_qty,$max_qty,$cat,$sku,$des,$youtubleLink);
// Code done by sanjivani
//$jinput->set('saveAttri',1); // whether have to save attributes or not
//$jinput->set('saveMedia',1);
$item_id = $comquick2cartHelper->saveProduct($cur_post);
if (is_numeric($item_id)) {
/*
$prodmodel = $this->getModel('product');
// Added by Sneha
$admin_app = $params->get('admin_approval');
$url_item_id = $jinput->get('item_id');
if ($admin_app == 1 && $url_item_id == '')
{
// While saving new product and admin approval set to 1
$prodmodel->SendMailToAdminApproval($cur_post, $item_id, $newProduct = 1);
$prodmodel->SendMailToOwner($cur_post);
}
$on_edit = $params->get('mail_on_edit');
if ($on_edit == 1 && $url_item_id != '')
{
// while editing new product and admin approval set to 0
$prodmodel->SendMailToAdminApproval($cur_post, $item_id, $newProduct = 0);
}
*/
//$prodmodel->StoreAllAttribute($item_id,$cur_post['att_detail'],$cur_post['sku'],'com_quick2cart'); // already stored in saveproduct funtion
if ($saveClose == 1) {
return 1;
}
//End Added by Sneha
$app->setUserState('item_id', $item_id);
$this->setRedirect(JUri::base() . "index.php?option=com_quick2cart&view=product&item_id=" . $item_id, JText::_('C_SAVE_M_S'));
} else {
//save attribute if any $msg = JText::_('C_SAVE_M_NS');
$this->setRedirect(JUri::base() . "index.php?option=com_quick2cart&view=product", JText::_('C_SAVE_M_NS'));
}
} else {
$this->setRedirect(JUri::base() . "index.php?option=com_quick2cart&view=product", JText::_('C_FILL_COMPULSORY_FIELDS'));
}
}