Skip to content

Commit e635185

Browse files
committed
feat: update API to new version
1 parent 9825549 commit e635185

File tree

58 files changed

+1109
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1109
-322
lines changed

controllers/front/graphql.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ public function setMedia()
2626
parent::setMedia();
2727
$this->context->controller->registerStylesheet(
2828
'modules-vuefront-front-css',
29-
'modules/vuefront/views/css/front.css',
29+
'modules/vuefront/views/css/index.css',
3030
array('media' => 'all', 'priority' => 200)
3131
);
32+
33+
$this->context->controller->registerJavascript(
34+
'modules-vuefront-front-js',
35+
'modules/vuefront/views/js/middleware.js',
36+
array('position' => 'head', 'priority' => 0)
37+
);
3238
}
3339

3440
public function initContent()
@@ -38,14 +44,15 @@ public function initContent()
3844
$accepts = explode(',', $_SERVER['HTTP_ACCEPT']);
3945
if (in_array('text/html', $accepts)) {
4046
$this->context->smarty->assign(array(
41-
'hello' => 'Hello World!!!'
47+
'hello' => 'Hello World!!!',
48+
'target' => __PS_BASE_URI__.'index.php?controller=graphql&module=vuefront&fc=module'
4249
));
4350

4451
$this->setTemplate('module:vuefront/views/templates/front/d_vuefront.tpl');
4552
return;
4653
}
4754
}
4855

49-
start($this->context);
56+
start($this->context, $this->getTranslator(), $this->objectPresenter);
5057
}
5158
}

mapping.json

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
"paymentMethods": "store/checkout/paymentMethods",
3535
"shippingMethods": "store/checkout/shippingMethods",
3636
"createOrder": "store/checkout/createOrder",
37+
"updateOrder": "store/checkout/updateOrder",
38+
"confirmOrder": "store/checkout/confirmOrder",
39+
"totals": "store/checkout/totals",
3740

3841
"cart": "store/cart/get",
3942
"addToCart": "store/cart/add",

model/common/country.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getCountries($data)
4040
$sql->leftJoin('country_shop', 'cs', 'cs.`id_country` = c.`id_country`');
4141
$sql->leftJoin('country_lang', 'cl', 'cl.`id_country` = c.`id_country`');
4242
$sql->where('cl.`id_lang` = ' . (int) $this->context->language->id);
43-
43+
$sql->where('c.`active` = 1');
4444
if (!empty($data['filter_name'])) {
4545
$sql->where("cl.`name` LIKE '%" . pSQL($data['filter_name']). "%'");
4646
}
@@ -63,7 +63,7 @@ public function getTotalCountries($data)
6363
$sql->leftJoin('country_shop', 'cs', 'cs.`id_country` = c.`id_country`');
6464
$sql->leftJoin('country_lang', 'cl', 'cl.`id_country` = c.`id_country`');
6565
$sql->where('cl.`id_lang` = ' . (int) $this->context->language->id);
66-
66+
$sql->where('c.`active` = 1');
6767
if (!empty($data['filter_name'])) {
6868
$sql->where("cl.`name` LIKE '%" . pSQL($data['filter_name']). "%'");
6969
}

resolver/common/country.php

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public function getList($args)
5353
$results = $this->model_common_country->getCountries($filter_data);
5454
$country_total = $this->model_common_country->getTotalCountries($filter_data);
5555

56+
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
57+
$availableCountries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
58+
} else {
59+
$availableCountries = Country::getCountries($this->context->language->id, true);
60+
}
61+
5662
foreach ($results as $value) {
5763
$countries[] = $this->get(array( 'id' => $value['id_country'] ));
5864
}

resolver/startup/startup.php

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function index()
3030
'If-Modified-Since,Cache-Control,Content-Type,Range,Token,token,Cookie,cookie,content-type');
3131
}
3232

33+
3334
$this->load->model('startup/startup');
3435

3536
try {
@@ -45,6 +46,7 @@ public function index()
4546

4647
$variableValues = isset($input['variables']) ? $input['variables'] : null;
4748
$result = GraphQL::executeQuery($schema, $query, $resolvers, null, $variableValues);
49+
4850
} catch (\Exception $e) {
4951
$result = [
5052
'error' => [

0 commit comments

Comments
 (0)