Reputation: 663
I am trying to pull all articles from single VirtueMart category. I am having problem with pagination and default settings set in VirtueMart (max items per page).
I have this code below which works for limited number of articles (set in VM settings). This gives data for 40 articles. Is there a way to pass parameter of a page I want to load? For example, if I have 400 articles, VM will show 10 pages in pagination. How can I pass pagination and load page number 2 for example? I do not mind if have to load all 400 articles at once and implement my own pagination.
include_once JPATH_ROOT . '/administrator/components/com_virtuemart/models/product.php';
$model = new VirtueMartModelProduct();
$items = $model->getProductsInCategory($this->input->get("catid"));
foreach ($items as $key => $item) {
$item = get_object_vars($item);
$item['media'] = $mediaModel->getFiles("", "", $item['virtuemart_product_id']);
$objekt = (object)[
"mf_name" => $item['mf_name'],
'product_name' => $item['product_name'],
'prices' => [
'product_override_price' => $item['prices']['product_override_price'],
'product_price' => $item['prices']['product_price'],
'discountAmount' => $item['prices']['discountAmount'],
],
'file_url' => $item['media'][0]->file_url,
'virtuemart_category_id' => $item['categoryItem'][0]['virtuemart_category_id'],
'category_name' => $item['customfields'][0]->custom_title,
'link' => $item['link']
];
$output[] = $objekt;
}
Upvotes: 0
Views: 210