Jump to content

Alexander Firsov

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by Alexander Firsov

  1. I also have this problem when trying to install Prestashop 1.7.7.1 on my Windows IIS Server 8.5
  2. I have the same problem with "Classic" theme in Shop.Theme.Catalog
  3. Yes, it does work like a charm! Thank you.
  4. Thank you very much for pointing me to the right direction!
  5. My payment gateway provider unfortunately doesn't have a payment module for Prestashop v1.7 What they have is a payment module for Prestashop v1.6 And I am just trying to use a module developed for Prestashop v1.6 in my Prestashop v1.7 Here is the module's PHP code: <?php require_once(dirname(__FILE__).'/../../config/config.inc.php'); if (!defined('_PS_VERSION_')) exit; class Paysolutions extends PaymentModule { private $_html = ''; private $_postErrors = array(); const STATE_PENDING = 'PAYSOLUTIONS_OS_PENDING'; const STATUS_PENDING = 'Paysolutions Payment Pending'; public function __construct() { $this->name = 'paysolutions'; $this->tab = 'payments_gateways'; $this->version = '1.6'; $this->author = 'PrestaShop'; $this->currencies = true; $this->currencies_mode = 'radio'; parent::__construct(); /* The parent construct is required for translations */ $this->page = basename(__FILE__, '.php'); $this->displayName = $this->l('PAYSOLUTIONS Secure Gateway'); $this->description = $this->l('Accepts payments by PAYSOLUTIONS Co.,Ltd (Thailand)'); $this->confirmUninstall = $this->l('Are you sure you want to delete your details ?'); } public function getPaysolutionsUrl() { return "https://www.thaiepay.com/epaylink/payment.aspx"; } public function install() { if (!parent::install() || !$this->registerHook('payment') || !$this->registerHook('paymentReturn') || !$this->addOrderStates()) return false; return true; } public function addOrderStates() { $id = $this->_addOrderState(self::STATUS_PENDING); Configuration::updateValue(self::STATE_PENDING, $id); return true; } public function removeOrderStates() { $this->_deleteOrderState(Configuration::get(self::CFG_STATE_INPROCESS)); Configuration::deleteByName(self::CFG_STATE_INPROCESS); $this->_deleteOrderState(Configuration::get(self::CFG_STATE_PENDING)); Configuration::deleteByName(self::CFG_STATE_PENDING); return true; } private function _addOrderState($name) { $OrderState = new OrderState(); $OrderState->name = array_fill(0, 10, $name); $OrderState->send_mail = 0; $OrderState->invoice = 0; $OrderState->color = '#4169E1'; $OrderState->unremovable = true; $OrderState->logable = 0; $OrderState->add(); return $OrderState->id; } public function uninstall() { if (!Configuration::deleteByName('PAYSOLUTIONS_MERCHANTID') || !parent::uninstall()) return false; return true; } public function getContent() { $this->_html = '<h2>PAYSOLUTIONS Payment Module</h2>'; if (isset($_POST['submitPaysolutions'])) { if (empty($_POST['MerchantID'])) $this->_postErrors[] = $this->l('PAYSOLUTIONS MerchantID is required.'); if (!sizeof($this->_postErrors)) { Configuration::updateValue('PAYSOLUTIONS_MERCHANTID', $_POST['MerchantID']); Configuration::updateValue('PAYSOLUTIONS_VISA', isset($_POST['accept_visa']) ? $_POST['accept_visa']:0 ); Configuration::updateValue('PAYSOLUTIONS_AMEX', isset($_POST['accept_amex']) ? $_POST['accept_amex']:0); //Configuration::updateValue('PAYSOLUTIONS_CHARGE', $_POST['charge']); if (isset($_POST['charge'])) { //Firsov Configuration::updateValue('PAYSOLUTIONS_CHARGE', $_POST['charge']); } $this->displayConf(); } else $this->displayErrors(); } $this->displayPaysolutions(); $this->displayFormSettings(); return $this->_html; } public function displayConf() { $this->_html .= ' <div class="conf confirm"> <img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" /> '.$this->l('Settings updated').' </div>'; } public function displayErrors() { $nbErrors = sizeof($this->_postErrors); $this->_html .= ' <div class="alert error"> <h3>'.($nbErrors > 1 ? $this->l('There are') : $this->l('There is')).' '.$nbErrors.' '.($nbErrors > 1 ? $this->l('errors') : $this->l('error')).'</h3> <ol>'; foreach ($this->_postErrors AS $error) $this->_html .= '<li>'.$error.'</li>'; $this->_html .= ' </ol> </div>'; } public function displayPaysolutions() { $this->_html .= ' <img src="../modules/paysolutions/paysolutions.png" style="float:left; margin-right:15px;" /> <b>'.$this->l('This is an official PAYSOLUTIONS payment gateway for Prestashop').'</b><br /><br /> '.$this->l('You MUST configure your PAYSOLUTIONS account first before using this module.').' <br /><br /><br /><br/>'; } public function displayFormSettings() { $conf = Configuration::getMultiple(array('PAYSOLUTIONS_MERCHANTID','PAYSOLUTIONS_AMEX','PAYSOLUTIONS_VISA','PAYSOLUTIONS_CHARGE')); // E-Mail Address $MerchantID = array_key_exists('MerchantID', $_POST) ? $_POST['MerchantID'] : (array_key_exists('PAYSOLUTIONS_MERCHANTID', $conf) ? $conf['PAYSOLUTIONS_MERCHANTID'] : ''); $accept_amex = array_key_exists('accept_amex', $_POST) ? $_POST['accept_amex'] : (array_key_exists('PAYSOLUTIONS_AMEX', $conf) ? $conf['PAYSOLUTIONS_AMEX'] : ''); $accept_visa = array_key_exists('accept_visa', $_POST) ? $_POST['accept_visa'] : (array_key_exists('PAYSOLUTIONS_VISA', $conf) ? $conf['PAYSOLUTIONS_VISA'] : ''); $charge = array_key_exists('charge', $_POST) ? $_POST['charge'] : (array_key_exists('PAYSOLUTIONS_CHARGE', $conf) ? $conf['PAYSOLUTIONS_CHARGE'] : '0'); $this->_html .= ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset> <legend><img src="../img/admin/contact.gif" />'.$this->l('Settings').'</legend> <label>'.$this->l('MerchantID').'</label> <div class="margin-form"> <input type="text" size="33" name="MerchantID" value="'.htmlentities($MerchantID, ENT_COMPAT, 'UTF-8').'" /> </div> <br /> <center><input type="submit" name="submitPaysolutions" value="'.$this->l('Update settings').'" class="button" /></center> <br /> </fieldset> </form> <br /><br /> '; } public function hookPayment($params) { global $smarty; $address = new Address(intval($params['cart']->id_address_invoice)); $customer = new Customer(intval($params['cart']->id_customer)); $business = Configuration::get('PAYSOLUTIONS_MERCHANTID'); $currency = $this->getCurrency(); //if (!Validate::isEmail($business)) //return $this->l('PAYSOLUTIONS error: (invalid or undefined account MerchantID)'); if (!Validate::isLoadedObject($address) OR !Validate::isLoadedObject($customer) OR !Validate::isLoadedObject($currency)) return $this->l('PAYSOLUTIONS error: (invalid address or customer)'); $products = $params['cart']->getProducts(); foreach ($products as $key => $product) { $products[$key]['name'] = str_replace('"', '\'', $product['name']); if (isset($product['attributes'])) $products[$key]['attributes'] = str_replace('"', '\'', $product['attributes']); $products[$key]['name'] = htmlentities(utf8_decode($product['name'])); $products[$key]['paysolutionsAmount'] = number_format(Tools::convertPrice($product['price_wt'], $currency), 2, '.', ''); } $ChargeMultiplier = (Configuration::get('PAYSOLUTIONS_CHARGE') + 100) / 100; $smarty->assign(array( 'address' => $address, 'country' => new Country(intval($address->id_country)), 'customer' => $customer, 'business' => $business, 'currency' => $currency, 'accept_visa' => Configuration::get('PAYSOLUTIONS_VISA'), 'accept_amex' => Configuration::get('PAYSOLUTIONS_AMEX'), 'paysolutionsUrl' => $this->getPaysolutionsUrl(), 'amount' => number_format(Tools::convertPrice($params['cart']->getOrderTotal(true, 4) * $ChargeMultiplier , $currency), 2, '.', ''), 'shipping' => number_format(Tools::convertPrice(($params['cart']->getOrderShippingCost() + $params['cart']->getOrderTotal(true, 6)), $currency), 2, '.', ''), 'discounts' => $params['cart']->getDiscounts(), 'products' => $products, 'total' => number_format(Tools::convertPrice($params['cart']->getOrderTotal(true, 3)* $ChargeMultiplier , $currency), 2, '.', ''), 'id_cart' => intval($params['cart']->id), 'postUrl' => 'http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'index.php?controller=order-confirmation&key='.$customer->secure_key.'&id_cart='.intval($params['cart']->id).'&id_module='.intval($this->id), 'reqUrl' => 'http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/paysolutions/validation.php', 'this_path' => $this->_path, 'Charge' => Configuration::get('PAYSOLUTIONS_CHARGE'), )); return $this->display(__FILE__, 'payment.tpl'); } public function getL($key) { $translations = array( 'mc_gross' => $this->l('Paysolutions key \'mc_gross\' not specified, can\'t control amount paid.'), 'payment_status' => $this->l('Paysolutions key \'payment_status\' not specified, can\'t control payment validity'), 'payment' => $this->l('Payment: '), 'custom' => $this->l('Paysolutions key \'custom\' not specified, can\'t rely to cart'), 'txn_id' => $this->l('Paysolutions key \'txn_id\' not specified, transaction unknown'), 'mc_currency' => $this->l('Paysolutions key \'mc_currency\' not specified, currency unknown'), 'cart' => $this->l('Cart not found'), 'order' => $this->l('Order has already been placed'), 'transaction' => $this->l('Paysolutions Transaction ID: '), 'verified' => $this->l('The Paysolutions transaction could not be VERIFIED.'), 'connect' => $this->l('Problem connecting to the Paysolutions server.'), 'nomethod' => $this->l('No communications transport available.'), 'socketmethod' => $this->l('Verification failure (using fsockopen). Returned: '), 'curlmethod' => $this->l('Verification failure (using cURL). Returned: '), 'curlmethodfailed' => $this->l('Connection using cURL failed'), ); return $translations[$key]; } public function hookPaymentReturn($params) { $payment_status = substr($_POST["result"], 0, 2); $id_order = trim(substr($_POST["result"],2)); $amount = $_POST['amt']; global $smarty; $smarty->assign(array( 'payment_status' => $payment_status, 'id_order' => $id_order, 'amount' => $amount, )); return $this->display(__FILE__, 'order-confirmation.tpl'); } } ?> I think I need to edit public function install() What do you think?
  6. No, it is not transplanted to the paymentOptions hook. And so I think this may be a problem. It is transplanted to the payment hook instead! So it's not visible on the Checkout Page. How to retransplant it to the paymentOptions hook?
  7. The payment module is transplanted to displayPaymentReturn hook. OK, what's next?
  8. I have the same problem. And I checked and verified that the payment method that is not showing on the Checkout Page is indeed enabled for this Currency, Group, Country and Carrier.
  9. I experience an extremely slow initialization of Prestashop Back Office Admin Dashboard, it takes about 3 minutes or more after successful log-in to complete initialization. During this time the Admin Dashboard is irresponsive. My Prestashop version is 1.7.7.1 installed on Microsoft IIS server 8.5 (Windows Server 2012R operating system). I am using PHP version 7.3 and MySQL version 5.7 I am using the old MySQL version because it still has the good old PHP request cacheing option. And I find it very useful indeed.
  10. Yes, absolutely. This problem is caused by Cloudflare. After I applied this solution the problem disappeared immediately! So it appears that you cannot use the "Check the IP address on the cookie" feature if you are using Cloudflare in "Full SSL" mode.
  11. Thank you very much, it is working like a charm! I have improved it a little bit <div style="text-align: center; margin: 3px;"> <form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh"> <input type="hidden" name="token" value="{$static_token}"> <input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id"> <button class="btn btn-primary add-to-cart {if $product.quantity < 1}out-of-stock{/if}" data-button-action="add-to-cart" type="submit"> <i class="material-icons shopping-cart">shopping_cart</i> {l s='Add to cart' d='Shop.Theme.Actions'} </button> </form> </div> and placed this code just after {block name='product_reviews'} {hook h='displayProductListReviews' product=$product} {/block}
  12. Thank you very much for this solution. I am testing it now in Prestashop 1.7.7.1 It seems to be working as expected!
  13. There is the same bug in the latest PS 1.7.7.1 😭 UPDATE: I was able to fix this problem. Create a new child theme Copy "assets" and "templates" folders from the Parent theme's folder to the new Child theme's folder Switch over to the new child theme (Design -> Theme & Logo, scroll down, select the new Child theme from the list of available themes, click "Use this theme") Update all the language packs you need to have translations to (this is very important) Voila, the problem has disappeared.
  14. Please make sure that you have entered the product weight in the Catalog -> Products section of Back Office
  15. src\Adapter\Cart\CartPresenter.php is deprecated since 1.7.4.0
  16. And there is another approach I have implemented in my old ISC shopping cart, and the same approach can be used for Prestashop or any other shopping cart software. The total product weight is multiplied by 1.1 (adding 10% for wrapping materials) and the box weight is added. This way we can estimate the total package weight before shipping. The formula is very simple: (total product weight before packing) x 1.1 + (box weight). There are 5 or 7 standard postal boxes, and we should estimate which box will be used for a certain weight range. I have edited the ISC shopping cart PHP code to insert this simple formula to correct the total product weight. This method gives me surprisingly good results with minimal error.
  17. Thank you very much! It worked for me in Prestashop 1.7.7.0
  18. The black background on the images appears only on those images that originally had a transparent background (in PNG and GIF formats), and after you have activated the Watermark module and rebuilt the thumnails. If you want to use the Watermark module for your product pictures you must convert transparent color into white color. This can be achieved easily by saving the PNG or GIF picture in another format, for example JPG format. This will automatically convert all areas with transparent color into white color. IrfanView by default is replacing transparent color with black color but this behaviour can be changed in the program settings. I believe that the Watermark module should be upgraded to allow the Back Office administrator to select the color (black or white) to replace the transparent color in the PNG and GIF images while processing the images to superimpose the watermark.
  19. I am now on Prestashop 1.7.7.0 How to change the default banner image in the Classic theme so that it appears automatically in every language by default without having to configure it separately for every single language?
  20. I am now on Prestashop 1.7.7.0 How to change the default banner image in the Classic theme so that it appears automatically in every language by default without having to configure it separately for every single language? After I replaced the original Classic theme banner image for one of the languages in the Back Office, the Banner block disappeared from all other language versions in the Front Office. I didn't expect this bahaviour. In order to restore the Banner block now I have to upload the new banner image for every installed language manually. I found this tutorial https://zemez.io/prestashop/support/how-to/prestashop-1-6-x-how-to-set-up-slider-and-banners-manually-using-source-scripts/ Shall I go this way? It seems a bit difficult for achieving a simple goal described above.
  21. This must be edited explicitly for every single language installed in your Prestashop, doesn't it? How to change the default banner image so that it appears automatically in every language without having to configure it separately for every single language?
  22. Thank you. I have successfully installed the Module in my Prestashop 1.7.7.0 Now I don't understand how to configure this module, please see the attached screenshot. Is this correct? Is it all I have to do?
×
×
  • Create New...