本文整理汇总了PHP中TiendaHelperBase::getColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP TiendaHelperBase::getColumn方法的具体用法?PHP TiendaHelperBase::getColumn怎么用?PHP TiendaHelperBase::getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiendaHelperBase
的用法示例。
在下文中一共展示了TiendaHelperBase::getColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteExpiredSessionProductCompared
/**
*
* Enter description here ...
* @return unknown_type
*/
public function deleteExpiredSessionProductCompared()
{
$db = JFactory::getDBO();
Tienda::load('TiendaQuery', 'library.query');
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = new TiendaHelperBase();
$query = new TiendaQuery();
$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 TiendaQuery();
$query->delete();
$query->from("#__tienda_productcompare");
$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->toMySQL();
// Update config to say this has been done already
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$config = JTable::getInstance('Config', 'TiendaTable');
$config->load(array('config_name' => 'last_deleted_expired_sessionproductscompared'));
$config->config_name = 'last_deleted_expired_sessionproductscompared';
$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', 'TiendaTable');
if (!$row->delete($item->productquantity_id)) {
JError::raiseNotice('1', $row->getError());
}
unset($items[$key]);
}
$done[] = $item->product_attributes;
}
// add new ones
$existingEntries = TiendaHelperBase::getColumn($items, 'product_attributes');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
foreach ($csvs as $csv) {
if (!in_array($csv, $existingEntries)) {
$row = JTable::getInstance('ProductQuantities', 'TiendaTable');
$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;
}