本文整理汇总了PHP中CitruscartHelperBase::getColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP CitruscartHelperBase::getColumn方法的具体用法?PHP CitruscartHelperBase::getColumn怎么用?PHP CitruscartHelperBase::getColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CitruscartHelperBase
的用法示例。
在下文中一共展示了CitruscartHelperBase::getColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteExpiredSessionCarts
/**
*
* Enter description here ...
* @return unknown_type
*/
public function deleteExpiredSessionCarts()
{
$db = JFactory::getDBO();
Citruscart::load('CitruscartQuery', 'library.query');
Citruscart::load("CitruscartHelperBase", 'helpers._base');
$helper = new CitruscartHelperBase();
$query = new CitruscartQuery();
$query->select("tbl.session_id");
$query->from("#__session AS tbl");
$db->setQuery((string) $query);
$results = $db->loadAssocList();
$session_ids = $helper->getColumn($results, 'session_id');
$query = new CitruscartQuery();
$query->delete();
$query->from("#__citruscart_carts");
$query->where("`user_id` = '0'");
$query->where("`session_id` NOT IN('" . implode("', '", $session_ids) . "')");
$db->setQuery((string) $query);
if (!$db->query()) {
$this->setError($db->getErrorMsg());
return false;
}
$date = JFactory::getDate();
$now = $date->toSql();
// Update config to say this has been done already
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
$config = JTable::getInstance('Config', 'CitruscartTable');
$config->load(array('config_name' => 'last_deleted_expired_sessioncarts'));
$config->config_name = 'last_deleted_expired_sessioncarts';
$config->value = $now;
$config->save();
return true;
}
示例2: reconcileProductAttributeCSVs
/**
* Adds any necessary _productsquantities records
*
* @param unknown_type $product_id Product ID
* @param unknown_type $vendor_id Vendor ID
* @param array $items Array of productQuantities objects
* @param unknown_type $csvs CSV output from getProductAttributeCSVs
* @return array $items Array of objects
*/
static function reconcileProductAttributeCSVs($product_id, $vendor_id, $items, $csvs)
{
// remove extras
$done = array();
foreach ($items as $key => $item) {
if (!in_array($item->product_attributes, $csvs) || in_array($item->product_attributes, $done)) {
$row = JTable::getInstance('ProductQuantities', 'CitruscartTable');
if (!$row->delete($item->productquantity_id)) {
JError::raiseNotice('1', $row->getError());
}
unset($items[$key]);
}
$done[] = $item->product_attributes;
}
// add new ones
$existingEntries = CitruscartHelperBase::getColumn($items, 'product_attributes');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
foreach ($csvs as $csv) {
if (!in_array($csv, $existingEntries)) {
$row = JTable::getInstance('ProductQuantities', 'CitruscartTable');
$row->product_id = $product_id;
$row->vendor_id = $vendor_id;
$row->product_attributes = $csv;
if (!$row->save()) {
JError::raiseNotice('1', $row->getError());
}
$items[] = $row;
}
}
return $items;
}