本文整理汇总了PHP中comquick2cartHelper::add_date方法的典型用法代码示例。如果您正苦于以下问题:PHP comquick2cartHelper::add_date方法的具体用法?PHP comquick2cartHelper::add_date怎么用?PHP comquick2cartHelper::add_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comquick2cartHelper
的用法示例。
在下文中一共展示了comquick2cartHelper::add_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addEntryInOrderItemFiles
/**
* On order confirm, add product media file in orderitemFIlesTable
*
* @param INT $order_id order_id
*
* @return VOID
*/
public function addEntryInOrderItemFiles($order_id)
{
$productHelper = new productHelper();
$comquick2cartHelper = new comquick2cartHelper();
$params = JComponentHelper::getParams('com_quick2cart');
$eProdExpFormat = $params->get('eProdExpFormat', 'epMonthExp');
// Down count/ date limit / both
$eProdUExpiryMode = $params->get('eProdUExpiryMode', 'epMaxDownload');
$db = JFactory::getDBO();
$q = "SELECT `item_id`,`order_item_id`,`product_quantity`\n\t\t\t\tFROM `#__kart_order_item`\n\t\t\t\tWHERE `order_id` =" . (int) $order_id;
$db->setQuery($q);
$result = $db->loadAssocList();
foreach ($result as $res) {
$item_id = $res['item_id'];
$mediaDetail = $productHelper->getMediaDetail($item_id);
// Copy all media
foreach ($mediaDetail as $media) {
$pfile = new stdClass();
$pfile->product_file_id = $media['file_id'];
$pfile->order_item_id = $res['order_item_id'];
$pfile->expirary_date = '';
$que = 'SELECT of.id FROM `#__kart_orderItemFiles` AS of
where of.order_item_id=' . $pfile->order_item_id . ' AND of.`product_file_id`=' . $pfile->product_file_id . ' ORDER BY of.id';
$db->setQuery($que);
$fileid = $db->loadResult();
if (!empty($fileid)) {
// Actually will not come inside. still for worse case
$action = "updateObject";
$pfile->id = $fileid;
} else {
$action = "insertObject";
$pfile->cdate = date('Y-m-d H:i:s');
}
// if purchase require not req
if ($media['purchase_required'] == 0) {
$pfile->download_limit = -1;
} else {
// DATE EXPIRATION
if ($eProdUExpiryMode == 'epDateExpiry' || $eProdUExpiryMode == 'epboth') {
// expirary in months
if ($media['expiry_mode'] == 1) {
// months
$exdate = $comquick2cartHelper->add_date($pfile->cdate, 0, $media['expiry_in']);
} else {
// in days
$exdate = $comquick2cartHelper->add_date($pfile->cdate, $media['expiry_in']);
}
$pfile->expirary_date = $exdate;
}
if ($eProdUExpiryMode == 'epMaxDownload' || $eProdUExpiryMode == 'epboth') {
if ($media['download_limit'] > 0) {
// not for unlimited
$pfile->download_limit = $media['download_limit'] * $res['product_quantity'];
} else {
$pfile->download_limit = $media['download_limit'];
}
}
}
$pfile->expiration_mode = $eProdUExpiryMode;
if (!$db->{$action}('#__kart_orderItemFiles', $pfile, 'id')) {
echo JText::_("COM_QUICK2CART_ERROR_WHILE_ASSIGNING_MEIDA_FILE_TO_ORDER") . $db->stderr();
return false;
}
}
}
}