Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

5_minutes_Turkish

Newbie
  
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

5_minutes_Turkish's Achievements

Apprentice

Apprentice (3/14)

  • Dedicated Rare
  • Week One Done
  • First Post
  • Reacting Well Rare
  • Conversation Starter

Recent Badges

1

Reputation

  1. как вам угодно) но если что вам просто показалось
  2. не в этом дело. Нэймы инпутов данного плагина формируются из плэйсхолдеров с кучей [ ] / и тд как оказалось.. Логику дальше в вашем же стиле "сами додумайте"
  3. Всем привет! Использую модуль sobfeedback, при отправки формы пытаюсь спарсить данные из нее, и переслать их уже далее в нужные файл php для передачи в crm. Но почему-то данные не парсятся... абсолютно не пойму почему, тестировал разными способами - все тщетно. Парсю обычным аяксом, а сам код вставляю в шаблоны которые создаются в public_html/catalog/view/theme/default/template/extension/module/feedback По сути просто дополняю скрипт в шаблоне своим аяском. В итоге он выглядит вот так <script type="text/javascript"> $('#form-sobfeedback<?php echo $module_id; ?>').on('submit', function(e) { e.preventDefault(e); var that = $(e.target); $.ajax({ url: 'index.php?route=extension/module/sobfeedback/send', type: 'post', data: $(this).serialize(), dataType:'json', success: function(data) { if (data['error']) { $('#form-sobfeedback<?php echo $module_id; ?> .text-danger').remove(); if (data['error']) { var error = $('<span class="text-danger">'+ data['error'] +'</span>'); $('#form-sobfeedback<?php echo $module_id; ?> .modal-body').prepend(error); } return; } $('#form-sobfeedback<?php echo $module_id; ?> .text-danger').remove(); //alertForm({form: that, msg: data['success']}); $('#success .modal__success-title').text(data['success']); $('#success').fancybox().trigger('click'); that.find('input[type=\'text\']').val(''); that.find('input[type=\'email\']').val(''); that.find('textarea').val(''); }, }); //МОЙ ПАРС - НАЧАЛО var formData = JSON.stringify($(this).serialize()); $.ajax({ //'contentType': 'application/json', // по умочанию application/x-www-form-urlencoded //'processData': 'application/json', // по умочанию application/x-www-form-urlencoded //'async': false, 'method': 'POST', 'dataType': 'json', 'url': 'amocrm/examples/elean_unsorted_zapis_primerka_mobile_id44.php', 'data': formData, 'success': function(data) { console.log('lead added'); console.log(data.message); //alert(data.message); }, 'error': function(xhr, status, error) { var errorData = 'Ошибочка вышла: ' + '\n[' + xhr.status + ' ' + status + ']' + ' ' + error + ' \n '+ xhr.responseText + xhr.responseJSON; console.log(errorData); } }); //МОЙ ПАРС - КОНЕЦ }); function alertForm(alert) { var div = $('<div class="text-left alert alert-success" style="display: none;">' + alert.msg + '</div>'); alert.form.prepend(div); div.slideDown(400).delay(3000).slideUp(400, function() { //alert.form.closest('.modal').modal('hide'); div.remove(); }); } </script> При этом при проверке отправки - формы приходят в crm, но данные из ее полей не передаются. Начал проверять - понял что данные из формы просто не парсятся... прилетают null-ы При этом если в этот же шаблон вставляю свою бланковую форму и только свой аяксовский скрипт - все отрабатывает отлично. В общем если у кого-то есть светлые мысли на этот счет - буду премного благодарен! Кстати, странный момент заметил: в свою форму (на которой проверял) вставил сразу после открывающего <form> <input type="hidden" id="utmterm_field" name="UTM_TERM" value="blablablasss"> который вообще никак не задействован по идее... Так вот, когда эта строка присутствует моей форме (на которой проверял) - данные парсятся. как только ее убираю - даже из моей формы не парсятся... большего бреда в жизни не встречал...
  4. Добрый день. Столкнулся с проблемой когда не отрабатывает код на передачу данных при добавлении товара в корзину. Версия ocStore 2.3.0.2.4 При этом при удалении товара скрипты отлично отрабатывают Может кто знает в чем причина или сталкивался с подобным уже? Скрипты на пуш в ДЛ добавляю в стандартный common.js - в функции переменной cart соответственно к скриптам добавил коменты // СКРИПТ КОТОРЫЙ ПУШИТ ПРИ ДОБАВЛЕНИИ / УДАЛЕНИИ чтоб понятно было где что выглядит примерно так // Cart add remove functions var cart = { 'add': function(product_id, quantity) { $.ajax({ url: 'index.php?route=checkout/cart/add', type: 'post', data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1), dataType: 'json', beforeSend: function() { }, complete: function() { }, success: function(json) { $('.alert, .text-danger').remove(); if (json['redirect']) { location = json['redirect']; } if (json['success']) { // Need to set timeout otherwise it wont update the total setTimeout(function () { $('.header-item.cardIcon span').html(json['total_cart']); }, 100); // dataLayer.push({ // 'event': 'addToCart', //added for test // 'ecommerce': { // 'currencyCode': 'RUB', // 'add': { // 'products': [{ // 'name': '' + json['name'] + '', // 'id': '' + product_id + '' // }] // } // } // }); // СКРИПТ КОТОРЫЙ ПУШИТ ПРИ ДОБАВЛЕНИИ dataLayer.push({ "ecommerce": { //added for test "currencyCode": "RUB", "add": { "products": [ { "id": '' + product_id + '', "name": '' + json['name'] + '', "quantity": 1 } ] } } }); // СКРИПТ КОТОРЫЙ ПУШИТ ПРИ ДОБАВЛЕНИИ //$('html, body').animate({ scrollTop: 0 }, 'slow'); $('#cart').load('index.php?route=common/cart/info #cart .load'); $('#currentTotal').text(json['subtotal']); } }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); }, 'update': function(key, quantity) { $.ajax({ url: 'index.php?route=checkout/cart/edit', type: 'post', data: 'key=' + key + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1), dataType: 'json', beforeSend: function() { }, complete: function() { }, success: function(json) { // Need to set timeout otherwise it wont update the total setTimeout(function () { $('.header-item.cardIcon span').html(json['total_cart']); }, 100); if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') { location = 'index.php?route=checkout/cart'; } else { $('#cart').load('index.php?route=common/cart/info #cart .load'); $('#currentTotal').text(json['subtotal']); } }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); }, 'remove': function(key) { $.ajax({ url: 'index.php?route=checkout/cart/remove', type: 'post', data: 'key=' + key, dataType: 'json', beforeSend: function() { }, complete: function() { }, success: function(json) { // СКРИПТ КОТОРЫЙ ПУШИТ ПРИ УДАЛЕНИИ dataLayer.push({ //added for test 'event': 'removeFromCart', 'ecommerce': { 'remove': { 'products': [{ 'name': '' + json['name'] + '', 'id': '' + key + '' }] } } }); // СКРИПТ КОТОРЫЙ ПУШИТ ПРИ УДАЛЕНИИ // Need to set timeout otherwise it wont update the total setTimeout(function () { $('.header-item.cardIcon span').html(json['total_cart']); }, 100); var now_location = String(document.location.pathname); if ((now_location == '/cart/') || (now_location == '/checkout/') || (getURLVar('route') == 'checkout/cart') || (getURLVar('route') == 'checkout/checkout')) { location = 'index.php?route=checkout/cart'; } else { $('#cart').load('index.php?route=common/cart/info #cart .load'); } if($('#custom-cart').length){ custom_block.render('cart'); custom_block.render('total'); $('#currentTotal').text(json['subtotal']); } }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } } Я думал мб что не так с конструкцией которую пушу при добавлении товара в корзину (хотя по идее должно быть пофиг)... но все тщетно (( В общем странная штука.. не понимаю в чем проблема
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.