Is er hier iemand van jullie die op een succesvolle wijze een wishlist heeft kunnen integreren?
Ik heb hem toegevoegd en hij werkt, maar ik krijg steeds 1 of meerdere errors (afhankelijk van wat de laatste actie was).
De errors die ik tegenkom:
Code: Select all
Notice: Undefined index: product_id in /home/dogabulv/domains/techprojectmasters.com/public_html/ZuS/catalog/controller/account/wish_list.php on line 29Notice: Undefined index: success in /home/dogabulv/domains/techprojectmasters.com/public_html/ZuS/catalog/controller/account/wish_list.php on line 56
Dit is het controller bestand:
Code: Select all
<?php
class ControllerAccountWishList extends Controller {
private $error = array();
public function index() {
$this->language->load('account/wish_list');
if (!$this->customer->isLogged()) {
//$this->session->data['redirect'] = HTTPS_SERVER . 'account/wish_list&product_id='.@$this->request->get['product_id'];
//$this->session->data['success'] = $this->language->get('text_error');
$this->redirect(HTTPS_SERVER . 'index.php?route=account/login');
}
$this->load->model('account/wish_list');
$this->document->title = $this->language->get('heading_title');
//remove product to wishlist
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['remove'])) {
foreach (array_keys($this->request->post['remove']) as $key) {
$this->model_account_wish_list->removeWishList($this->customer->getId(), $key);
}
$this->session->data['success'] = $this->language->get('text_deleted');
}
}
//add product to wishlist
if ($this->customer->isLogged() && $this->request->get['product_id']) {
if($this->model_account_wish_list->addProductWishList($this->customer->getId(), $this->request->get['product_id'])) {
$this->session->data['success'] = $this->language->get('text_success');
}
$this->redirect(HTTPS_SERVER . 'index.php?route=account/wish_list');
}
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=common/home',
'text' => $this->language->get('text_home'),
'separator' => FALSE
);
$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=account/account',
'text' => $this->language->get('text_account'),
'separator' => $this->language->get('text_separator')
);
$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=account/wish_list',
'text' => $this->language->get('text_wish_list'),
'separator' => $this->language->get('text_separator')
);
$this->data['success'] = @$this->session->data['success'];
unset($this->session->data['success']);
//column
$this->data['column_remove'] = $this->language->get('column_remove');
$this->data['column_image'] = $this->language->get('column_image');
$this->data['column_name'] = $this->language->get('column_name');
$this->data['column_model'] = $this->language->get('column_model');
$this->data['column_price'] = $this->language->get('column_price');
//buttons
$this->data['button_update'] = $this->language->get('button_update');
$this->data['button_shopping'] = $this->language->get('button_shopping');
//action -> remove
$this->data['action'] = HTTP_SERVER . 'index.php?route=account/wish_list';
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['products'] = array();
//show wish list
if ($this->model_account_wish_list->getTotalWishLists($this->customer->getId()) > 0)
{
$this->load->model('tool/seo_url');
$this->load->model('tool/image');
foreach ($this->model_account_wish_list->getWishLists($this->customer->getId()) as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'name' => $result['name'],
'model' => $result['model'],
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height')),
'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id'])
);
}
}
else
{
$this->data['text_no_results'] = $this->language->get('text_no_results');
}
$this->data['continue'] = HTTPS_SERVER . 'index.php?route=common/home';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/wish_list.tpl')) {
$this->template = $this->config->get('config_template') . '/template/account/wish_list.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}
$this->children = array(
'common/header',
'common/footer',
'common/column_left',
'common/column_right'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
}
?>
Wouter