Skip to content

Using product compare

Gunjan Patel edited this page May 20, 2016 · 2 revisions

Init

$compare = new RedshopProductCompare();

// Prepare Item
$item = new stdClass;
$item->productId  = $productId;
$item->categoryId = $categoryId;

Add to compare

$compare->addItem($item);

Delete item from compare

// Remove specific item
$compare->deleteItem($item);

// Remove all
$compare->deleteItem();

Get ajax response

$html = $compare->getAjaxResponse();

Get total of items in compare list

$total = $compare->getItemsTotal();

// Check if it empty
$compare->isEmpty();

Get all the items in compare

$list = $compare->getItems();

Get category id on which compare is based on

$compareCategoryId = $compare->getCategoryId();

Since version 1️⃣.6️⃣

Clone this wiki locally