Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript][MSSQL][PHP]OPENCart z pluginem lbcoupons - wspolpraca
Forum PHP.pl > Forum > Przedszkole
php__amator
Hej tam przedszkolacy smile.gif

Do osobnikow zorientowanych w temacie openSource'owego WebShopu OPENCart

Od pewnego czasu walcze z OpENCart'em w kwestii wysylania kuponu zaraz po rejestracji nowego uzytkownika. podstawowy e-mail wysyla poprawnie.
Zainstalowalem dodatkowy modul lbcoupons ktory powinien (ale tego nie robi) wysylac drugiego maila do tegoz uzytkownika zaraz po tym jak wysle
formularz rejestracyjny.
Niestety z jakiegos powodu (chociaz wedlug autora procedura instalacji jest idiotrycznie prosta i powinno dzialac) nie dziala.
Za chiny ludowe nie wiem dlaczego, czesc skryptu dziala na pewno. Wysledzilem to sprawdzajac co jest zapisywane do bazy (zmienialem pewne stale dane i te pojawialy sie w bazie)
Natomiast ta czesc ktora powinna byc umieszczona i wyslana .... nie dziala sad.gif
jesli ktokolwiek z was mial do czynienia z takim problemem pilnie prosze o podpowiedz czego szukac albo co moze byc powodem ;(

tzm
Skoro autor dal instrukcje a wujek google nie podpowiada ze jest bledna, to blad robisz zapewne Ty. Skoro nie wiemy jaki to blad, to skad mamy wiedziec o co chodzi? rzucaj errorami, warningami, noticami a nie rzucaj slowami. Tu sie programuje, nie dyskutuje.
php__amator
He he he ... hej,
no fakt, problem niestety polega na tym, że nigdzie, żadnych errorów nie widzę, przeglądałem
wszystko co potrafię sam zlokalizować w tej kwestii i NIC.
Sprawdziłem też działanie skryptu. Jeśli na sztywno podstawię dane, część skryptu która odpowiada za zapisanie tychże do zaby działa jak należy jedynie nie wysyła maila do 'świeżo' zarejestrowanego użytkownika sklepu a powinien sad.gif
Sam moduł żeby działać potrzebuje vqmod, sprawdziłem czy działa vqmod i najwyraźniej działa bo inne moduły które też tego wymagają działają bez problemu. Jedynie lbcoupon nie chce sad.gif
Składa się ten moduł z kilku plików z czego najważniejszy jest plik xml z którego instrukcje są przepisywane do odpowiednich skryptów.
oto on lbcoupon.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. -<modification>
  4.  
  5. <id>Generate Coupon on Registration</id>
  6.  
  7. <version>1.0.0</version>
  8.  
  9. <vqmver>2.3.0</vqmver>
  10.  
  11. <author>BJaBakaL</author>
  12.  
  13.  
  14. -<file name="catalog/controller/account/register.php">
  15.  
  16.  
  17. -<operation>
  18.  
  19.  
  20. -<search position="after">
  21.  
  22. <![CDATA[ $this->model_account_customer->addCustomer($this->request->post); ]]>
  23.  
  24. </search>
  25.  
  26.  
  27. -<add>
  28.  
  29. <![CDATA[ $config_lbcoupon = $this->config->get( 'lbcoupon_vibhag' ); $lbcoupon_type = $config_lbcoupon['discount_type']; $lbcoupon_amount = (empty($config_lbcoupon['discount_amount'])) ? '0' : $config_lbcoupon['discount_amount']; $lbcoupon_duration = (empty($config_lbcoupon['discount_duration'])) ? '15' : $config_lbcoupon['discount_duration']; if($config_lbcoupon['status']) { $couponcode = substr(number_format(time() * rand(),0,'',''),0,10); $this->db->query("INSERT INTO " . DB_PREFIX . "coupon SET name = 'Discount For " . $this->request->post['email'] . "', code = '" . $couponcode . "', discount = '" . $lbcoupon_amount . "', type = '" . $lbcoupon_type . "', total = '1000000.0000', logged = '1', shipping = '1', date_start = NOW(), date_end = CURDATE() + INTERVAL $lbcoupon_duration DAY, uses_total = '1', uses_customer = '1', status = '1', date_added = NOW()"); if($lbcoupon_type == 'F') { //$message = sprintf('You can take Discount 5 USD . Just Appy this Coupon code : '.$couponcode, $this->config->get('config_name')) . "\n\n"; $message = "You can take USD $lbcoupon_amount Discount on any purchase". "\n\n"; $message .= "Just Appy this Coupon code : $couponcode"; } else { $message = "You can take $lbcoupon_amount % Discount on any purchase". "\n\n"; $message .= "Just Appy this Coupon code : $couponcode"; } $subject = sprintf('Thanks for Registering with us and We will Give Discount For You ', $this->config->get('config_name')); $to = $this->request->post['email']; $sender_name = $this->config->get('config_name'); $sender_email = $this->config->get('config_email'); $headers = array(); $headers[] = "MIME-Version: 1.0"; $headers[] = "Content-type: text/plain; charset=iso-8859-1"; $headers[] = "From: $sender_name <$sender_email>"; $headers[] = "Bcc: Mastah <roberta@uznam.net.pl>"; $headers[] = "Reply-To: $to <$sender_email>"; $headers[] = "Subject: {$subject}"; $headers[] = "X-Mailer: PHP/".phpversion(); mail($to, $subject, $message, implode("\r\n", $headers)); } ]]>
  30.  
  31. </add>
  32.  
  33. </operation>
  34.  
  35. </file>
  36.  
  37. </modification>

i php
  1. <?php
  2. class ControllerModuleLbCoupon extends Controller {
  3. private $error = array();
  4.  
  5. public function index() {
  6. $this->language->load('module/lbcoupon');
  7.  
  8. $this->document->setTitle($this->language->get('heading_title'));
  9.  
  10. $this->load->model('setting/setting');
  11.  
  12. if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
  13.  
  14. $this->model_setting_setting->editSetting('lbcoupon', $this->request->post);
  15.  
  16. $this->session->data['success'] = $this->language->get('text_success');
  17.  
  18. $this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
  19. }
  20.  
  21. $this->data['text_enabled'] = $this->language->get('text_enabled');
  22. $this->data['text_disabled'] = $this->language->get('text_disabled');
  23.  
  24. $this->data['heading_title'] = $this->language->get('heading_title');
  25. $this->data['entry_title'] = $this->language->get('entry_title');
  26. $this->data['entry_discount_duration'] = $this->language->get('entry_discount_duration');
  27. $this->data['entry_discount_amount'] = $this->language->get('entry_discount_amount');
  28. $this->data['entry_status'] = $this->language->get('entry_status');
  29. $this->data['entry_discount_type'] = $this->language->get('entry_discount_type');
  30.  
  31. $this->data['button_save'] = $this->language->get('button_save');
  32. $this->data['button_cancel'] = $this->language->get('button_cancel');
  33. $this->data['entry_module_title'] = $this->language->get( 'entry_module_title' );
  34. $this->data['tab_module'] = $this->language->get('tab_module');
  35. $this->data['entry_image_navigator'] = $this->language->get( 'entry_image_navigator' );
  36.  
  37.  
  38. if (isset($this->error['warning'])) {
  39. $this->data['error_warning'] = $this->error['warning'];
  40. } else {
  41. $this->data['error_warning'] = '';
  42. }
  43.  
  44. $this->data['breadcrumbs'] = array();
  45.  
  46. $this->data['breadcrumbs'][] = array(
  47. 'text' => $this->language->get('text_home'),
  48. 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
  49. 'separator' => false
  50. );
  51.  
  52. $this->data['breadcrumbs'][] = array(
  53. 'text' => $this->language->get('text_module'),
  54. 'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
  55. 'separator' => ' :: '
  56. );
  57.  
  58. $this->data['breadcrumbs'][] = array(
  59. 'text' => $this->language->get('heading_title'),
  60. 'href' => $this->url->link('module/lbcoupon', 'token=' . $this->session->data['token'], 'SSL'),
  61. 'separator' => ' :: '
  62. );
  63.  
  64. $this->data['action'] = $this->url->link('module/lbcoupon', 'token=' . $this->session->data['token'], 'SSL');
  65.  
  66. $this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
  67.  
  68. $this->data['token'] = $this->session->data['token'];
  69.  
  70. $this->data['modules'] = array();
  71.  
  72.  
  73. if (isset($this->request->post['lbcoupon_vibhag'])) {
  74. $this->data['modules'] = $this->request->post['lbcoupon_vibhag'];
  75. } elseif ($this->config->get('lbcoupon_vibhag')) {
  76. $this->data['modules'] = $this->config->get('lbcoupon_vibhag');
  77. }
  78.  
  79. $this->template = 'module/lbcoupon.tpl';
  80. $this->children = array(
  81. 'common/header',
  82. 'common/footer'
  83. );
  84.  
  85. $this->response->setOutput($this->render());
  86. }
  87.  
  88. protected function validate() {
  89. if (!$this->user->hasPermission('modify', 'module/lbcoupon')) {
  90. $this->error['warning'] = $this->language->get('error_permission');
  91. }
  92.  
  93. if (!$this->error) {
  94. return true;
  95. } else {
  96. return false;
  97. }
  98. }
  99. }
  100. ?>

Wyciąłem fragment wysyłający maila, wkleiłem do osobnego pliku. odpaliłem i wysłało więc na serwerze mailer działa. Jedynie nie mogę doszukać się problemu w tym właśnie pliku, dlaczego nie działa sad.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.