本文整理汇总了PHP中comquick2cartHelper::imageupload方法的典型用法代码示例。如果您正苦于以下问题:PHP comquick2cartHelper::imageupload方法的具体用法?PHP comquick2cartHelper::imageupload怎么用?PHP comquick2cartHelper::imageupload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comquick2cartHelper
的用法示例。
在下文中一共展示了comquick2cartHelper::imageupload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/** This function save the store detail.
* USED IN PLUGIN:: ACCORDING TO REGISTERED USER ACCESS LAVEL , NEW SOTRE IS CREATD FOR THAT USER
* @param object $post post
* @param integer userid.
* @return userid number
* */
function store($post, $userid = '')
{
$params = JComponentHelper::getParams('com_quick2cart');
$email = $post->get('email', '', 'RAW');
if (!empty($email)) {
$db = JFactory::getDBO();
$user = JFactory::getUser();
$oldData = '';
// Get old data if exists
$id = $post->get('id');
if (!empty($id)) {
$query = "SELECT `id`, store_avatar, header\n\t\t\t\t FROM #__kart_store\n\t\t\t\t WHERE `id`=" . $id;
$db->setQuery($query);
$oldData = $db->loadAssoc($query);
}
$oldAvtarPath = !empty($oldData) ? $oldData['store_avatar'] : '';
$oldHeaderPath = !empty($oldData) ? $oldData['header'] : '';
$row = new stdClass();
$row->owner = $user->id;
if ($userid != '') {
$row->owner = $userid;
}
$row->description = $post->get('description', '', 'RAW');
$row->company_name = $post->get('companyname', '', 'RAW');
$row->address = $post->get('address', '', 'RAW');
$row->phone = $post->get('phone');
$row->store_email = $post->get('email', '', 'RAW');
$row->length_id = $post->get('qtc_length_class', '', 'INTEGER');
$row->weight_id = $post->get('qtc_weight_class', '', 'INTEGER');
$row->taxprofile_id = $post->get('taxprofile_id', '', 'INTEGER');
$row->shipprofile_id = $post->get('qtc_shipProfile', '', 'INTEGER');
// Added by vbmundhe Dont remove as it is require on install script
$helper_path = JPATH_SITE . '/components/com_quick2cart/helper.php';
if (!class_exists('comquick2cartHelper')) {
JLoader::register('comquick2cartHelper', $helper_path);
JLoader::load('comquick2cartHelper');
}
$comquick2cartHelper = new comquick2cartHelper();
// STORE LOGO IMGE
$avatar = $post->get('avatar', '', 'RAW');
if (!empty($avatar)) {
$avtar_path = $avatar;
} else {
$img_dimensions = array();
$img_dimensions[] = 'storeavatar';
// upload avtar
// name of file field
$file_field = "avatar";
$avtar_path = $comquick2cartHelper->imageupload($file_field, $img_dimensions, 0);
}
if (!empty($avtar_path)) {
// AVOID IMAGE OVERWRITE TO NULL WHILE UPDATE
$row->store_avatar = $avtar_path;
}
// STORE STOREHEADER IMGE
/*if (!empty($post['storeheader']))
{
$header_path=$post['storeheader'];
}
else
{
// upload header img
$file_field="storeheader"; // name of file field in from view eg <input type="file" name="avatar" id="avatar" />
$header_path=$comquick2cartHelper->uploadImage($file_field,$oldHeaderPath);
}*/
$header_path = '';
$row->header = $header_path;
$extra = $post->get('extra', '', 'RAW');
if (!empty($extra)) {
// While update , AVOID DONT MAKE EMPTY
$row->extra = $extra;
}
$row->payment_mode = $post->get('paymentMode');
if (empty($row->payment_mode)) {
$row->pay_detail = $post->get('paypalemail', '', 'RAW');
} else {
$row->pay_detail = $post->get('otherPayMethod', '', 'RAW');
}
$quick2cartModelVendor = new quick2cartModelVendor();
//$row->live =$post['title'];
//$row->extra=
$id = "";
$title = $post->get('title', '', 'RAW');
$storeVanityUrl = $post->get('storeVanityUrl', '', 'RAW');
$id = $post->get('id', '', 'RAW');
// If already present then update
if (!empty($oldData)) {
$row->title = $quick2cartModelVendor->formatttedTitle($title, $id);
$row->vanityurl = $quick2cartModelVendor->formatttedVanityURL($storeVanityUrl, $title, $id);
$row->id = $id = $oldData['id'];
$row->mdate = date("Y-m-d");
try {
$db->updateObject('#__kart_store', $row, 'id');
} catch (RuntimeException $e) {
//.........这里部分代码省略.........
示例2: storecurrency
/**
* Save the product basic option.
*
* @param object $curr_post Post objec.
*
* @since 2.2
* @return null
*/
function storecurrency($curr_post)
{
$itemname = $curr_post->get('item_name', '', 'STRING');
$store_id = $curr_post->get('store_id', '', 'STRING');
$pid = $curr_post->get('pid', '', 'STRING');
//@TODO check - ^sanjivani
if (empty($pid)) {
// For native product manager
$pid = $curr_post->get('item_id', '', 'STRING');
}
//@TODO check - ^sanjivani
$client = $curr_post->get('client', '', 'STRING');
$sku = $curr_post->get('sku', '', 'RAW');
$res = '';
$message = '';
$comquick2cartHelper = new comquick2cartHelper();
$db = JFactory::getDbo();
$params = JComponentHelper::getParams('com_quick2cart');
$kart_curr_param = $params->get('addcurrency');
// used to store in kart_item table
$kart_curr_param_array = explode(',', $kart_curr_param);
$kart_item_curr = $kart_curr_param_array[0];
$quick2cartModelAttributes = new quick2cartModelAttributes();
//@TODO check - ^sanjivani
//$item_id = $quick2cartModelAttributes->getitemid($pid, $client, $sku);
$item_id = $quick2cartModelAttributes->getitemid($pid, $client);
$img_dimensions = array();
$img_dimensions[] = 'small';
$img_dimensions[] = 'medium';
$img_dimensions[] = 'large';
$image_path = array();
// STORING ALL IMAGES images upladed (on new or edit)
foreach ($_FILES as $key => $imgfile) {
if (!empty($imgfile['name'])) {
$image_path[] = $comquick2cartHelper->imageupload($key, $img_dimensions);
//$imgfile['name']);
}
}
$qtc_prodImgs = $curr_post->get('qtc_prodImg', array(), 'ARRAY');
// ON EDIT
if (!empty($qtc_prodImgs)) {
foreach ($image_path as $newImg) {
$qtc_prodImgs[] = $newImg;
}
//$image_path = $curr_post->get('qtc_prodImg', array(), 'ARRAY'); //$curr_post['qtc_prodImg'];
$image_path = array_filter($qtc_prodImgs, "trim");
}
if (!empty($image_path)) {
$image_path = json_encode($image_path);
} else {
$image_path = '';
}
//@TODO save images and store in DB
$images = "";
//GETTING ATTRIBUTE DETAILS,multi currency and discount details
$att_detail = $curr_post->get('att_detail', array(), 'ARRAY');
$multi_cur = $curr_post->get('multi_cur', array(), 'ARRAY');
$multi_dis_cur = $curr_post->get('multi_dis_cur', array(), 'ARRAY');
if (!$item_id) {
$state = $curr_post->get('state');
if (empty($state)) {
$state = 0;
}
// Call the trigger to add extra field in product page.
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin("system");
$result = $dispatcher->trigger("beforeSavingProductBasicDetail", array($curr_post, 'insert'));
// Save new product
$item_id = $this->storeInKartItem('insert', $image_path, $multi_cur[$kart_item_curr], $curr_post);
} else {
$state = $curr_post->get('state');
// dont set default value as 1 (require for unpublish)
if (isset($state)) {
$state = $state;
}
$productHelper = $comquick2cartHelper->loadqtcClass(JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . "helpers" . DS . "product.php", "productHelper");
$productHelper->deleteNotReqProdImages($item_id, $image_path);
// Call the trigger to add extra field in product page.
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin("system");
$result = $dispatcher->trigger("beforeSavingProductBasicDetail", array($curr_post, 'update'));
$item_id = $this->storeInKartItem('update', $image_path, $multi_cur[$kart_item_curr], $curr_post);
}
$message = $item_id;
$query = "SELECT * FROM #__kart_base_currency WHERE item_id = " . (int) $item_id;
$db->setQuery($query);
$res = $db->loadAssocList();
//if there is a entry in kart_base_currency table
if ($res) {
foreach ($multi_cur as $cur_name => $cur_value) {
$db = JFactory::getDBO();
$flag = 0;
//.........这里部分代码省略.........