Jump to content

motabik

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by motabik

  1. problem solved
    I changed one function in the combinations class.
    I replaced it with a file in the overrides directory

    class Combination extends CombinationCore
    {
        public function deleteAssociations()
        {
            $result = Db::getInstance()->delete('product_attribute_combination', '`id_product_attribute` = '.(int) $this->id);
           // $result &= Db::getInstance()->delete('cart_product', '`id_product_attribute` = '.(int) $this->id);
            $result &= Db::getInstance()->delete('product_attribute_image', '`id_product_attribute` = '.(int) $this->id);

            if ($result) {
                Hook::exec('actionAttributeCombinationDelete', array('id_product_attribute' => (int)$this->id));
            }

            return $result;
        }
        
    }

  2. I Have litle problem with combinations,  when I using this method with webservice.

    Everything working ok, but after update product attribute, all customers who doing shopping in shop lost this product from their carts.

    After updating product via combinations, method combinations from webserwice delete this product from carts customer who now doing shopping.

    How I can disable this option or how I can update product combination price via webservice, and clients not lost this product from theirs carts.

     

  3. The problem is that I can't create an order without creating the "order_payments" object at the same time, which means that a new order is created in the store but has a payment assigned immediately. I can not set the order status to the one I want, it automatically sets to "Payment accepted" or "payment error" if I pass the wrong amount in the parameters to the API. What is the reason for this and can you create a new order without automatically generating a payment entry?

  4. Hi

     

    I search in google information, how I can add attachments to the mail order_conf.

    and I can't find.

    And I solve problem.

    I write how it can do.

    You must copy classes PaymentModule.php from folder classes to override/classes

    and edit this file.

    About line 761 You find function who add invoice // Join PDF invoice

    You must edit this  line and add your attachment.
    I add file for attachment in catalogue docs

    I  disable send invoice and change code for this.

     

    // Join PDF invoice
                            if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number) {
                                $order_invoice_list = $order->getInvoicesCollection();
                                Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
                                $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty);
                                $file_attachement['content'] = $pdf->render(false);
                                $file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf';
                                $file_attachement['mime'] = 'application/pdf';
                            } else {
                              //  $file_attachement = null;
                               $file_attachement['content'] = file_get_contents(_PS_ROOT_DIR_.'/docs/file1.pdf');
                               $file_attachement['name'] = File1.pdf';
                               $file_attachement['mime'] = 'application/pdf';
                               $file_attachement1['content'] = file_get_contents(_PS_ROOT_DIR_.'/docs/file2.pdf');
                               $file_attachement1['name'] = 'file2.pdf';
                               $file_attachement1['mime'] = 'application/pdf';
                               $attach =array($file_attachement, $file_attachement1);
                            }

                            if (self::DEBUG_MODE) {
                                PrestaShopLogger::addLog('PaymentModule::validateOrder - Mail is about to be sent', 1, null, 'Cart', (int)$id_cart, true);
                            }

                            if (Validate::isEmail($this->context->customer->email)) {
                                Mail::Send(
                                    (int)$order->id_lang,
                                    'order_conf',
                                    Mail::l('Order confirmation', (int)$order->id_lang),
                                    $data,
                                    $this->context->customer->email,
                                    $this->context->customer->firstname.' '.$this->context->customer->lastname,
                                    null,
                                    null,
                                    $attach,
                                    null, _PS_MAIL_DIR_, false, (int)$order->id_shop
                                );

  5. Yes, I wrote program to add, update all products, generate photos,
    and updated stock, price, status, etc.
    But I do this not API, becauce it not working good.

    I installed odbc for mysql and created connection with ADODB
    then I can update any table in database.

    here you have simple code.


    Private Const PrestaAccessMySql As String = "Driver={MySQL ODBC 3.51 Driver}; Server=serverDomain; Database=databaseName; Uid=databaseLogin; Pwd=databasePassword;"

    If you connect with other driver you must change Driver=
    Driver={MySQL ODBC 5.3 ANSI Driver}
    or other

    Function doQuery(ByRef txQuery As String) As Integer
    Dim conn As ADODB.Connection
    Dim rst As ADODB.Recordset
    On Error GoTo transError
    Set conn = New ADODB.Connection
    conn.Open PrestaAccessMySql
    Set rst = New ADODB.Recordset
    rst.Open txQuery, conn
    doQuery = 1
    conn.Close

    Exit Function
    transError:
    doQuery = 0
       conn.RollBack
       rst.Close
          conn.Close
       MsgBox Err.description
    End Function

    good luck



     

  6. Hi
    I develop import data from excel to prestashop with API.
    I have little problem with images management.
    What I create to send and import image for products.
    Communications is ready and I haven't any problem
    Here is my code.

    pathImage = "image=c:\Users\Downloads\blade.jpg"
    Dim TargetUrl As String
    TargetUrl = "http://MyPresta/api/images/products/2"
    Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    HTTPReq.Option(4) = 13056 '
    HTTPReq.Open "get", TargetUrl, False
    HTTPReq.SetCredentials "user", "password", 0
    HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

    HTTPReq.send (pathImage)
    MsgBox (HTTPReq.responseText)

     

  7. Hi

    I have little problem with webservice

    I link my excel with webservice and I try add new manufacturer
    My program send information to web service , and a get answer 201 Created.

    But in shop this manufacturer don't added.

    Please help

    Here is my code

    sURL = "http://xxx/api/manufacturers/"
        sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>"
       sEnv = sEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
        sEnv = sEnv & "  <soap:Body>"
         
     sEnv = sEnv & "<prestashop xmlns:xlink=""http://www.w3.org/1999/xlink"">"
    sEnv = sEnv & "<manufacturer><id>2</id><active>1</active><link_rewrite not_filterable=""true"">fashion-manufacturer</link_rewrite>"
    sEnv = sEnv & "<name>Fashion Manufacturer_new</name><date_add></date_add><date_upd></date_upd><description><language id=""1"" xlink:href=""http://XXXXXX/api/languages/1""></language></description><short_description><language id=""1"" xlink:href=""http://XXXXXX/api/languages/1""></language></short_description><meta_title>"
    sEnv = sEnv & "<language id=""1"" xlink:href=""http://XXXXXX/api/languages/1""></language></meta_title><meta_description><language id=""1"" xlink:href=""http://XXXXXX/api/languages/1""></language></meta_description><meta_keywords><language id=""1"" xlink:href=""http://XXXXXX/api/languages/1""></language></meta_keywords><associations><addresses node_type=""addresses""><addresses xlink:href=""http://XXXXXX/api/addresses/3""><id xlink:href=""http://XXXXXX/api/addresses/3"">3</id></addresses></addresses></associations></manufacturer></prestashop>"
       sEnv = sEnv & "  </soap:Body>"
        sEnv = sEnv & "</soap:Envelope>"
        Cells(1, 1) = sEnv
     
        With xmlhtp
            .Open "post", sURL, False, "XXXXXXXX"
            .setRequestHeader "Host", "XXXXX"
            .setRequestHeader "Content-Type", "text/xml; charset=utf-8"
            .setRequestHeader "soapAction", "http://[email protected]/api/manufacturers/"
            .setRequestHeader "Accept-encoding", "zip"
            .setRequestHeader "user", "xxxxxxx"
            .send (sEnv)
             
            
            
            MsgBox .Status & .statusText
             .abort
          
            
            
        End With

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More