Jump to content
thirty bees forum

Wartin

Members
  • Posts

    347
  • Joined

  • Last visited

  • Days Won

    18

Posts posted by Wartin

  1. On 5/12/2020 at 6:55 PM, AndyC said:

     

    
    class ContactController extends ContactControllerCore
    {
        public function postProcess()
        {
            if(Tools::isSubmit('submitMessage')) {
     
                $message = Tools::getValue('message');
                $from = Tools::getValue('from');
     
                $banned_in_email = ['.ru', 'qq.com', '.vn', 'talkwithlead.com', 'talkwithwebvisitor.com', '.club', '.cn', 'arteseo.co'];
                $banned_content = ['email marketing', 'quotation', 'SEO', 'advertising', 'Clicks', 'Guaranteed', 'diet', 'sex', 'unlimited', 'medical'];
     
                foreach ($banned_in_email as $string) {
                    if(strstr($from, $string))
                        $this->errors[] = Tools::displayError('This email address is not allowed');
                }
     
                foreach ($banned_content as $string) {
                    if(strstr($message, $string))
                        $this->errors[] = Tools::displayError('Invalid Content');
                }
            }
            parent::postProcess();
        }

     

     

    Hello. Today some bot created an account in my shop. The strange part is that the address is not yet published anywhere... but it's under an easy spanish word, 'MyHOST/tienda'.

    So I started trying this override to be prepared if I start receiving spam from the Contact Form when the site goes online.

    I created the file override/controllers/front/ContactController.php with the quoted class, I erased /cache/class_index.php.


    but the override is not working. I introduce an explicit PHP error but the emails keep being sent. I cleaned Cache too. What could be wrong?

  2. 2 hours ago, Fernando said:

    usefull_link_block
    class
    list-unstyled hidden-print

    is there a module or best to just use CSS?

    Thank you

    As far as I know you will have to delete that part from products' template.
    (make a backup first)

    Edit /themes/niara/product.tpl

    Search for these lines:

                <li>
                  <a href="javascript:print();" title="{l s='Print this page'}">
                    <i class="icon icon-fw icon-print"></i> {l s='Print'}
                  </a>
                </li>


    And erase them.

    Write this down, as if you update TB this change will be overwritten.

     

  3. Just add this to Preferences -> Custom Code -> Add custom CSS

    .btn:hover {
        background: #86c211;
        border: 1px solid #336600;
    }
    .btn-primary {
        background-color: #336600;
    }

    (change the colors to the colors of your preference)

     

    PD: to find out what CSS to change, for example in firefox you can try pressing F12. After that, with Control-Shift-C (or the very first icon) you can select something in the page and see what's the CSS involved. You can change things to try colors or changes there, and then write them in Custom CSS.

     

  4. 4 minutes ago, Owen said:

    Can you tell me how to edit the theme? I try to find the button to edit the theme in the back office, but I can't find it.

    I'm afraid you can't edit it from the Backoffice. Two columns in mobile it not a template option. That's why the changes are made directly in the template code. Are you in a shared hosting? You need to edit the template file directly, with a text editor.

    If you have SSH access you can log in and go to template directory, and edit it there. If you have FTP access you can do it from there, depending on your ftp program (or just download it, edit it in your computer and then upload it again)

    As you are modifying the file that shows your products, editing a .tpl could break things. Before editing make a backup of the file.

     

  5. Hello!

    I've just found out that the example file you can download to copy the headers for combination import is wrong. The second column should be 'Reference' and not 'Attribute'.

    The error was about group_type, that has to be of one of values: select, radio, color

    I read in a forum that Prestashop 1.6 has this problem too.

    I think it would be really great, to understand CSV, that the products listed to be the same that comes in TB as test products.

    Edit: I attached the same file, just added a new row (the second one).

     

    Captura de pantalla -2020-07-01 16-53-22.png

    combinations_import.csv

    • Like 1
  6. I didn't know what all these buttons in products do:

    1978569364_Capturadepantalla-2020-06-2821-57-30.png.0d1728f78f07f70713dceae4d66d6a80.png

    Now I know the second is an export. Very nice. The last one add that query to SQL queries.

    I don't know what could be wrong, but the exported file using button number two is separated only by ;

    So when I open it in for example libreoffice all the rows appear one after the other, in one line.

     

    Any help will be appreciated.

     

  7. I noticed that my products' description, after my test import, didn't have different lines, but just plain text all in one line.

    I use the data from SQL query where I select product's description. If I press 'view' button, the description shows something like:

    <div class="rte"> <p>adsf asd fasdfhal dsfash dfahsd fasjd</p> <p> </p> <p>asd</p> <p>f as</p> <p>df as</p> <p>df</p> <p>s</p> <p>long description</p> </div>

    If I export the same SQL command, resulting .sql file reads:

    adsf asd fasdfhal dsfash dfahsd fasjd^M
     ^M
    asd^M
    f as^M
    df as^M
    df^M
    s^M
    long description^M

    Obviously, when I use that .CSV file in an import, the description fields get broken.

    Maybe html is getting sanitized before exporting the CSV file?

    Thanks!

  8. Hello. I read in forums that it is possible to keep prices and stock updated via CSV import.

    The ERP's DB with the prices is very old and cannot make queries, so I export a listing, and after some bash magic I have a .csv prepared for import in TB, with real shop ID numbers (I use reference numbers to compare)

    With the same IDs as the shop, I choose 'Force ID numbers'. I can update, it works fine. But:

    I've figured out that if Description is empty, it deletes the old description. If the name is empty, it fails with 'name cannot be emtpy'.

    I would expect it to update the field if it has a value, and make nothing if it hasn't any, but not to empty it. Is it possible? It would make preparation of the import CSV much easier, as it would be done just with ID, price and stock columns.

    Thanks!

  9. On 5/10/2020 at 1:08 PM, yaniv14 said:

    If you are on a shared host and using Apache webserver, try to disable mod_security.

    I finally could understand your answer. That was the problem. I had the same 403 forbidden error when adding SQL queries.
    It is a shared host, so I logged in to cPanel and search for 'security'. After disabling Mod security I could create my query, and then i activate it again.

    Thanks!

  10. Hello. I was trying community-theme-modded by @toplakd. It has some great great things. For example, the cart in the checkout is just perfect for mobiles. He got rid off the table and replaced it with 'divs'.

    I tried to implement those changes to Niara, unsuccessfully. There are so many changes and couldn't make it yet.

    I'd like to know if somebody has tried or done it.

    Thank you!

     

    PS: this is the post for toplakd's theme, you can see the screenshots and try it too:

     

  11. One more :)

    I had to change some things to make it work well. I'll send my files, maybe it's useful.

    1) In Niara, as I said above, checkboxes didn't appear. Just after radio buttons there is always a <span> tag, unlike Community. If it's not there, the radio button is not shown. this is true in 'Accept terms', select delivery address and in carrier selection.

    2) Instead of adding all the functions from order-carrier.js to order-address.js, I added those two files to the override
    override/controllers/front/OrderController.php

        public function setMedia()
        {
            parent::setMedia();
            if ($this->step == 1) {
                $this->addJS(_THEME_JS_DIR_.'order-address.js');
                $this->addJS(_THEME_JS_DIR_.'order-carrier.js');
            }
        }


    3) In Step 2, I had an error in js console with updateExtraCarrier (did't find it, as it's in cart-summary.js). I added that function at the end of order-carrier.js.

     

    It's really cleaner to have 3 steps, maybe these changes are useful for somebody using Niara. If you find something wrong, please tell me. To use it, just like parents', make backup of your files and uncompress the .zip file in your shops' /

    3step-niara.zip

    • Like 1
  12. I had troubles with js in second step. If I press 'Read terms and conditions' link the modal didn't appear, but loaded in a new page. It didn't check if terms and conditions was checked and loaded step 3 if it wasn't.

    I saw you added functions from order-carrier.js to order-address.js, but for some reason didn't work in my almost ready shop (but yes in another brand new TB). So I added this to the override (override/controllers/front/OrderController.php), maybe could be used only this and not the js addition to order-address.

        public function setMedia()
        {
            parent::setMedia();
            if ($this->step == 1) {
                $this->addJS(_THEME_JS_DIR_.'order-carrier.js');
            }
        }
    
    

     

  13. On 4/5/2020 at 7:24 PM, AndyC said:

    Quick question ..Was looking on mobile and the terms conditions tick box was tiny

    Hello.

    Here in Niara the checkbox doesn't appear.

    1137732507_Capturadepantalla-2020-06-2120-05-26.png.293a6c9312388f86d0a4938c74d3fa84.png

    I compared the original order-carrier.tpl and it has a <span> around the terms and conditions phrase, like this

                    <span class="label-text">
                    {l s='I agree to the terms of service and will adhere to them unconditionally.'}
                    </span>

     

    Now the checkbox appears. I attach my complete file, themes/niara/order-carrier.tpl, with this change (line 354)

     

    order-carrier.tpl

  14. 35 minutes ago, toplakd said:

    There is no Shipping step, as its part of Address step, so disabled showing steps under carrier, as carrier template is called from address template.

    Oh, I realized how it's supposed to be, as seen in your first post image. Something is wrong here, as in Address it's not appearing the carriers below, and I can press 'next', it goes to the old carriers page (without step number in URL) . Let me investigate more.

     

    EDIT: cache issues.... after reading in you where is included carrier in order-address i went to that file, write something and save... and now it takes the changes.  excelent.

    Thanks for the link!!

     

     

  15. On 5/8/2020 at 3:44 PM, toplakd said:

    But I can send you my modded community theme for testing, which is more mobile friendly.

    Hello @toplakd. First of all thanks for this mod, it's really more clean and nice to see less steps. I'm just trying it in a backup installation and it works perfect.

    I just notice that you hid the order-steps bar when we are in shipping. I found it weird, so I uncommented:

    <!-- 
    ALZA Removing order steps from carrierer template for 3 page checkout
        {include file="$tpl_dir./order-steps.tpl"}
    -->

    And changed the name of that step to:

              {l s='Address & shipping'}

    in order-steps.tpl

     

    I'm trying to make it more mobile friendly, and liked your screenshots, could you send me your community theme mod, please? I'm using Niara, but can compare and try to adapt it.

    Thanks!

  16. OK, I could do it. I had to create a composer.json with the directories and php fies.

        "autoload": {
            "classmap": [
    "./Dir1/file.php",
    "./Dir1/Dir2/file2.php",
    "./Dir1/Dir3/",
           ]
        },

    And then run:

    composer dump-autoload -o

    then in my module file:

    require_once dirname(__FILE__) . '/vendor/autoload.php';

    Now I can call, for example:

    $val = new myclass();

     

  17. Hello. I'm making (trying to make) a carrier module for a carrier service in my country. I made an API version, based on carrier example code I found on github.

    I have a module that installs, adds a new carrier and after setting it up give me the price the API returns in the checkout. Very nice.

    The service also has an SDK for PHP. I tried it in a file out of TB and I can make calls and get prices. it uses 'use' and autoload function to load files. I had to add an spl_autoload_register function at the top of my .php file. I thought it would be easy to use the SDK in my module.... but I couldn't do it.

    Any advice? I read a lot today...

    Thanks!

  18. Bonjour @popolon, that was the problem! Merci :)

    I have a question, do you have a mails directory in your theme too? Because I edited all the mail templates but in /themes/niara/mails/es (from the BO I get a forbidden msg)

    now I copied

    order_conf_productan_list.tpl

    order_conf_product_list.txt

    to /themes/niara/mails/es and the order confirmation email now have the order detail.

     

    This is a little bug.

    Au revoir!

×
×
  • Create New...