Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
samberrry committed Oct 26, 2022
2 parents 2db3628 + ca7abd6 commit a02ddea
Show file tree
Hide file tree
Showing 7 changed files with 1,462 additions and 834 deletions.
7 changes: 7 additions & 0 deletions controllers/AbstractCartRESTController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ abstract class AbstractCartRESTController extends CartControllerCore {
public function init()
{
header('Content-Type: ' . "application/json");

if (Tools::getValue('iso_currency')){
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
$_GET['SubmitCurrency'] = "1";
}

parent::init();

switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
$this->processGetRequest();
Expand Down
6 changes: 6 additions & 0 deletions controllers/AbstractPaymentRESTController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ abstract class AbstractPaymentRESTController extends ModuleFrontController
public function init()
{
header('Content-Type: ' . "application/json");

if (Tools::getValue('iso_currency')){
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
$_GET['SubmitCurrency'] = "1";
}

if (!$this->context->customer->isLogged() && $this->php_self != 'authentication' && $this->php_self != 'password') {
$this->ajaxRender(json_encode([
'code' => 410,
Expand Down
7 changes: 7 additions & 0 deletions controllers/AbstractProductListingRESTController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ abstract class AbstractProductListingRESTController extends ProductListingFrontC
public function init()
{
header('Content-Type: ' . "application/json");

if (Tools::getValue('iso_currency')){
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
$_GET['SubmitCurrency'] = "1";
}

parent::init();

switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
$this->processGetRequest();
Expand Down
7 changes: 7 additions & 0 deletions controllers/AbstractRESTController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ abstract class AbstractRESTController extends ModuleFrontController
public function init()
{
header('Content-Type: ' . "application/json");

if (Tools::getValue('iso_currency')){
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
$_GET['SubmitCurrency'] = "1";
}

parent::init();

switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
$this->processGetRequest();
Expand Down
28 changes: 28 additions & 0 deletions controllers/front/productdetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ protected function processGetRequest()

$product = $this->getProduct();
$product['groups'] = $this->assignAttributesGroups($product);
$product['breadcrumb'] = $this->getBreadcrumbLinks();

$this->ajaxRender(json_encode([
'success' => true,
Expand Down Expand Up @@ -937,4 +938,31 @@ protected function assignAttributesGroups($product_for_template = null)
return [];
}
}

public function getBreadcrumbLinks()
{
$breadcrumb = parent::getBreadcrumbLinks();

$categoryDefault = new Category($this->product->id_category_default, $this->context->language->id);

foreach ($categoryDefault->getAllParents() as $category) {
if ($category->id_parent != 0 && !$category->is_root_category && $category->active) {
$breadcrumb['links'][] = [
'title' => $category->name,
'category_id' => $category->id,
'url' => $this->context->link->getCategoryLink($category),
];
}
}

if ($categoryDefault->id_parent != 0 && !$categoryDefault->is_root_category && $categoryDefault->active) {
$breadcrumb['links'][] = [
'title' => $categoryDefault->name,
'category_id' => $categoryDefault->id,
'url' => $this->context->link->getCategoryLink($categoryDefault),
];
}

return $breadcrumb['links'];
}
}
Loading

0 comments on commit a02ddea

Please sign in to comment.