本文整理汇总了PHP中AResource::getResourceAllObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP AResource::getResourceAllObjects方法的具体用法?PHP AResource::getResourceAllObjects怎么用?PHP AResource::getResourceAllObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AResource
的用法示例。
在下文中一共展示了AResource::getResourceAllObjects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_option_resources
public function get_option_resources()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$attribute_value_id = (int) $this->request->get['attribute_value_id'];
$output = array();
if ($attribute_value_id) {
$resource = new AResource('image');
// main product image
$sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height')));
$output['main'] = $resource->getResourceAllObjects('product_option_value', $attribute_value_id, $sizes, 1, false);
if (!$output['main']) {
unset($output['main']);
}
// additional images
$sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_additional_width'), 'height' => $this->config->get('config_image_additional_height')), 'thumb2' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height')));
$output['images'] = $resource->getResourceAllObjects('product_option_value', $attribute_value_id, $sizes, 0, false);
if (!$output['images']) {
unset($output['images']);
}
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->load->library('json');
$this->response->addJSONHeader();
$this->response->setOutput(AJson::encode($output));
}
示例2: getBlockContent
protected function getBlockContent($instance_id)
{
$block_info = $this->layout->getBlockDetails($instance_id);
$custom_block_id = $block_info['custom_block_id'];
$descriptions = $this->layout->getBlockDescriptions($custom_block_id);
if ($descriptions[$this->config->get('storefront_language_id')]) {
$key = $this->config->get('storefront_language_id');
} else {
$key = $descriptions ? key($descriptions) : null;
}
$this->loadModel('extension/banner_manager');
$results = $this->model_extension_banner_manager->getBanners($custom_block_id);
$banners = array();
if ($results) {
$rl = new AResource('image');
foreach ($results as $row) {
if ($row['banner_type'] == 1) {
// if graphic type
/**
* @var array
*/
$row['images'] = $rl->getResourceAllObjects('banners', $row['banner_id']);
//add click registration wrapper to each URL
//NOTE: You can remove below line to use tracking javascript instead. Javascript tracks HTML banner clicks
$row['target_url'] = $this->html->getURL('r/extension/banner_manager/click', '&banner_id=' . $row['banner_id'], true);
} else {
$row['description'] = html_entity_decode($row['description']);
}
$banners[] = $row;
}
}
$output = array('title' => $key ? $descriptions[$key]['title'] : '', 'content' => $banners, 'block_wrapper' => $key ? $descriptions[$key]['block_wrapper'] : 0, 'block_framed' => $key ? (int) $descriptions[$key]['block_framed'] : 0);
return $output;
}
示例3: get
public function get()
{
$this->extensions->hk_InitData($this, __FUNCTION__);
$product_id = $this->request->get['product_id'];
if (!$product_id) {
$this->rest->setResponseData(array('Error' => 'Missing product ID as a required parameter'));
$this->rest->sendResponse(200);
return null;
}
$products = array();
$this->loadModel('catalog/review');
$this->loadModel('catalog/product');
$results = $this->model_catalog_product->getProductRelated($product_id);
foreach ($results as $result) {
$resource = new AResource('image');
$sizes = array('main' => array('width' => $this->config->get('config_image_related_width'), 'height' => $this->config->get('config_image_related_height')), 'thumb' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height')));
$image = $resource->getResourceAllObjects('products', $result['product_id'], $sizes, 1);
if ($this->config->get('enable_reviews')) {
$rating = $this->model_catalog_review->getAverageRating($result['product_id']);
} else {
$rating = false;
}
$special = FALSE;
$discount = $this->model_catalog_product->getProductDiscount($result['product_id']);
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
$options = $this->model_catalog_product->getProductOptions($result['product_id']);
if ($options) {
$add = 'a/product/product';
} else {
$add = 'a/checkout/cart';
}
$products[] = array('product_id' => $result['product_id'], 'name' => $result['name'], 'model' => $result['model'], 'rating' => $rating, 'stars' => sprintf($this->language->get('text_stars'), $rating), 'price' => $price, 'options' => $options, 'special' => $special, 'image' => $image['main_url'], 'thumb' => $image['thumb_url'], 'cart_add_rt' => $add);
}
$this->extensions->hk_UpdateData($this, __FUNCTION__);
$this->rest->setResponseData(array('total' => count($products), 'related_products' => $products));
$this->rest->sendResponse(200);
}
示例4: getListing
public function getListing()
{
if (!$this->data['custom_block_id'] || !$this->data['descriptions']) {
return false;
}
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$listing = new AListing($this->data['custom_block_id']);
$content = unserialize($this->data['descriptions'][$this->config->get('storefront_language_id')]['content']);
if (!$content && $this->data['descriptions']) {
$content = current($this->data['descriptions']);
$content = unserialize($content['content']);
}
$this->data['controller'] = $content['block_appearance'];
$this->data['listing_datasource'] = $content['listing_datasource'];
$data_sources = $listing->getListingDataSources();
$data_source = $data_sources[$content['listing_datasource']];
if (strpos($content['listing_datasource'], 'custom_') === FALSE) {
// for auto listings
$route = $content['listing_datasource'];
$limit = $content['limit'];
// for resource library
if ($route == 'media') {
$rl = new AResource($content['resource_type']);
if (isset($this->request->get['product_id'])) {
$object_name = 'products';
$object_id = $this->request->get['product_id'];
} elseif (isset($this->request->get['category_id']) || isset($this->request->get['path'])) {
$object_name = 'categories';
if (isset($this->request->get['category_id'])) {
$object_id = $this->request->get['product_id'];
} else {
$temp = explode("_", $this->request->get['path']);
end($temp);
$object_id = current($temp);
}
} elseif (isset($this->request->get['manufacturer_id'])) {
$object_name = 'manufacturers';
$object_id = $this->request->get['manufacturer_id'];
}
$resources = $rl->getResourceAllObjects($object_name, $object_id, array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_product_width'), 'height' => $this->config->get('config_image_product_height'))), $limit, false);
if (!$resources) {
return null;
}
if ($limit == 1) {
$resources = array($resources);
}
foreach ($resources as $k => $resource) {
if ($resource['origin'] == 'external') {
$result[$k]['resource_code'] = $resource['thumb_html'];
} else {
if ($content['resource_type'] != 'image') {
$title = $resource['title'] ? $resource['title'] : 'dowload';
} else {
$title = $resource['title'];
}
$result[$k]['image'] = array('main_url' => $resource['main_url'], 'main_html' => $resource['main_html'], 'thumb_url' => $resource['thumb_url'], 'thumb_html' => $resource['thumb_html'], 'title' => $title, 'resource_type' => $content['resource_type']);
}
}
} else {
// otherwise - select list from method
if ($route) {
$this->loadModel($data_source['storefront_model']);
$result = call_user_func_array(array($this->{'model_' . str_replace('/', '_', $data_source['storefront_model'])}, $data_source['storefront_method']), $listing->getlistingArguments($data_source['storefront_model'], $data_source['storefront_method'], array('limit' => $limit)));
if ($result) {
$desc = $listing->getListingDataSources();
foreach ($desc as $d) {
if ($d['storefront_method'] == $data_source['storefront_method']) {
$data_source = $d;
break;
}
}
//add thumbnails to custom list of items. 1 thumbnail per item
$result = $this->_prepareCustomItems($data_source, $result);
}
}
}
} else {
// for custom listings
$list = $listing->getCustomList();
if (!$list) {
return null;
}
$this->load->model($data_source['storefront_model']);
foreach ($list as $item) {
$result[] = call_user_func_array(array($this->{'model_' . str_replace('/', '_', $data_source['storefront_model'])}, $data_source['storefront_method']), array($item['id']));
}
}
/*if($data_source['rl_object_name'] ){
$resource = new AResource('image');
}*/
if ($result) {
//add thumbnails to custom list of items. 1 thumbnail per item
$result = $this->_prepareCustomItems($data_source, $result);
}
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
return $result;
}
示例5: main
//.........这里部分代码省略.........
if ($this->model_catalog_product->isStockTrackable($product_id)) {
$total_quantity = $this->model_catalog_product->hasAnyStock($product_id);
$this->data['track_stock'] = true;
//out of stock if no quantity and no stick checkout is disabled
if ($total_quantity <= 0 && !$this->config->get('config_stock_checkout')) {
$this->data['in_stock'] = false;
//show out of stock message
$this->data['stock'] = $product_info['stock_status'];
} else {
$this->data['in_stock'] = true;
if ($this->config->get('config_stock_display')) {
$this->data['stock'] = $product_info['quantity'];
} else {
$this->data['stock'] = $this->language->get('text_instock');
}
}
//check if we need to disable product for no stock
if ($this->config->get('config_nostock_autodisable') && $total_quantity <= 0) {
//set available data
$pd_identifiers = "ID: " . $product_id;
$pd_identifiers .= empty($product_info['model']) ? '' : " Model: " . $product_info['model'];
$pd_identifiers .= empty($product_info['sku']) ? '' : " SKU: " . $product_info['sku'];
$message_ttl = sprintf($this->language->get('notice_out_of_stock_ttl'), $product_info['name']);
$message_txt = sprintf($this->language->get('notice_out_of_stock_body'), $product_info['name'], $pd_identifiers);
//record to message box
$msg = new AMessage();
$msg->saveNotice($message_ttl, $message_txt);
$this->model_catalog_product->updateStatus($product_id, 0);
$this->redirect($this->html->getSEOURL('product/product', '&product_id=' . $product_info['product_id'], '&encode'));
}
}
// main product image
$sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height')));
$this->data['image_main'] = $resource->getResourceAllObjects('products', $product_id, $sizes, 1, false);
if ($this->data['image_main']) {
$this->data['image_main']['sizes'] = $sizes;
}
// additional images
$sizes = array('main' => array('width' => $this->config->get('config_image_popup_width'), 'height' => $this->config->get('config_image_popup_height')), 'thumb' => array('width' => $this->config->get('config_image_additional_width'), 'height' => $this->config->get('config_image_additional_height')));
$this->data['images'] = $resource->getResourceAllObjects('products', $product_id, $sizes, 0, false);
$products = array();
$results = $this->model_catalog_product->getProductRelated($product_id);
foreach ($results as $result) {
// related product image
$sizes = array('main' => array('width' => $this->config->get('config_image_related_width'), 'height' => $this->config->get('config_image_related_height')), 'thumb' => array('width' => $this->config->get('config_image_related_width'), 'height' => $this->config->get('config_image_related_height')));
$image = $resource->getResourceAllObjects('products', $result['product_id'], $sizes, 1);
if ($this->config->get('enable_reviews')) {
$rating = $this->model_catalog_review->getAverageRating($result['product_id']);
} else {
$rating = false;
}
$special = FALSE;
$discount = $promoton->getProductDiscount($result['product_id']);
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], (bool) $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], (bool) $this->config->get('config_tax')));
$special = $promoton->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], (bool) $this->config->get('config_tax')));
}
}
$options = $this->model_catalog_product->getProductOptions($result['product_id']);
if ($options) {
$add = $this->html->getSEOURL('product/product', '&product_id=' . $result['product_id'], '&encode');
} else {