Browse Source

Fix : erreur 500 ajax page commande

L'url ne comprenait pas le slug du producteur.
refactoring
keun 6 years ago
parent
commit
baf0d85239
2 changed files with 9 additions and 4 deletions
  1. +1
    -0
      producer/views/layouts/main.php
  2. +8
    -4
      producer/web/js/lechatdesnoisettes.js

+ 1
- 0
producer/views/layouts/main.php View File

@@ -19,6 +19,7 @@ $producer = $this->context->getProducer() ;
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="base-url" content="<?= Yii::$app->urlManager->baseUrl ; ?>">
<meta name="slug-producer" content="<?= $producer->slug ; ?>">
<?= Html::csrfMetaTags() ?>
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon4.png" />
<?php $this->head() ?>

+ 8
- 4
producer/web/js/lechatdesnoisettes.js View File

@@ -140,8 +140,12 @@ function chat_init_horaire_point_vente(date) {
}) ;*/
}

function chat_base_url() {
return $('meta[name=base-url]').attr('content')+'/' ;
function chat_base_url(with_slug) {
var base_url = $('meta[name=base-url]').attr('content')+'/' ;
if(with_slug) {
base_url += $('meta[name=slug-producer]').attr('content')+'/' ;
}
return base_url ;
}

function chat_systeme_commande() {
@@ -169,7 +173,7 @@ function chat_systeme_commande() {
$('#modal-code form').submit(function() {
var id_pv = $('#modal-code #id-point-vente').val() ;
var code = $('#modal-code #code').val() ;
$.get(chat_base_url()+'commande/verif-code-point-vente',{
$.get(chat_base_url(true)+'commande/verif-code-point-vente',{
id_point_vente: id_pv,
code: code
}, function(ok) {
@@ -379,7 +383,7 @@ function chat_systeme_commande() {

function chat_systeme_commande_produits_dispos(str_date, date) {
// produits dispos à la vente à cette date
$.get(chat_base_url()+'commande/infos-production',{
$.get(chat_base_url(true)+'commande/infos-production',{
id_production: $('#commande-id_production').val()
}, function(data) {

Loading…
Cancel
Save