Skip to content

Commit

Permalink
fixed json html encoded issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Alcino Van Rooyen committed Nov 16, 2023
1 parent 0ffee7b commit 8f64be0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
16 changes: 12 additions & 4 deletions 8/pitchprint/pitchprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function updateProducts($params)

if ($row['pitchprint_customization']) {
if (gettype($row['pitchprint_customization']) === 'object') {
$row['pitchprint_cusotmization'] = json_decode(json_encode($row['pitchprint_customization']), true);
$row['pitchprint_customization'] = json_decode(json_encode($row['pitchprint_customization']), true);
}
$row['pitchprint_customization']['links'] = [];
if (strpos($row['pitchprint_customization']['distiller'], 'io') !== false) {
Expand Down Expand Up @@ -649,9 +649,17 @@ public function hookDisplayHeader($params)
'afterValidation' => ($this->context->controller->php_self === 'my-account' ? '_fetchProjects' : '_sortCart'),
];

$this->context->smarty->assign(['ppData' => $ppData]);

return $this->display(__DIR__, '/views/templates/front/ppCartData.tpl');
Media::addJsDef(
[
'pitchprintCartData' => $ppData,
]
);

$this->context->controller->registerJavascript(
'module-pitchprint-cart-data',
'modules/' . $this->name . '/views/js/cartData.js',
['position' => 'bottom', 'priority' => 199]
);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{*
/**
* 2023 PitchPrint
*
* NOTICE OF LICENSE
Expand All @@ -21,7 +21,5 @@
* @copyright 2023 PitchPrint Inc
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PitchPrint Inc.
*}
<script type="text/javascript">
var pp_data = {$ppData|json_encode}
</script>
*/
var pp_data = pitchprintCartData;
3 changes: 1 addition & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Added get order and design the old way if new way returns nothing.
Also store old designs the new way.
Fixed a bug in the cart, where JSON was html encoded and could not parse properly.

0 comments on commit 8f64be0

Please sign in to comment.