Forum Replies Created

Viewing 15 replies - 1 through 15 (of 64 total)
  • Did you check these details on that link:

    Vulnerable versions < 6.7.7
    Patched in 6.7.7

    So I assume if you are using latest version of WCFM you should be safe … isn’t it?

    Thread Starter Vivek Athalye

    (@vnathalye)

    For those who come across similar issue …

    My webhost admin asked me to create wildcard subdomain using cPanel.

    So I first removed the CNAME entry I had added manually. Then created wildcard subdomain from cPanel. Just to make it easier to handle, I created separate document root to handle all subdomain requests. In this folder I added .htaccess that is supposed to redirect user to main site.
    Also added index.php to understand if my .htaccess is getting applied or not.

    Initially this index.php was getting displayed. After some more testing I realized that the rewrite rule should have been like:

    RewriteRule .? https://myprods.com/category/%1 [R,L]

    The ? was missing and hence it was not getting applied, effectively showing my index.php.

    After updating this rewrite rule, all subdomains / URLs like https://type1.myprods.com are correctly getting redirected to https://myprods.com/category/type1, while keeping the demo site working separately.

    Thread Starter Vivek Athalye

    (@vnathalye)

    @ddsuresh my bad … I had forgotten to add DNS entry for subdomains 🙁 … after adding CNAME entry for *.myprods.com to point to myprods.com “site can’t be reached” error is gone.

    But now when I access https://type1.myprods.com, instead of showing my website, its showing me my webhost’s custom home page. I tried commenting my changes in .htaccess and still getting same behavior (webhost’s custom home page). which makes me think that the rewrite rule is not getting applied / .htaccess is not getting into picture at all.

    Is that correct understanding?
    Anyway I’ve raised a support ticket at my webhost. Hopefully will get a solution soon.

    • This reply was modified 2 months, 2 weeks ago by Vivek Athalye.
    Thread Starter Vivek Athalye

    (@vnathalye)

    Thanks @moderator

    @ddsuresh , I’ve put following rewrite rules in .htaccess. But it’s not working as per my requirement.


    RewriteCond %{HTTP_HOST} ^(.+\.)?demo\.myprods\.com
    RewriteRule . - [L]

    RewriteCond %{HTTP_HOST} !^myprods\.com$ [NC]
    RewriteCond %{HTTP_HOST} ^(.+)\.myprods\.com [NC]
    RewriteRule . https://myprods.com/category/%1 [R,L]

    The idea here is that, the first rule will ignore anything that points to demo site and let it get processed by the separate site hosted at demo.myprods.com.

    The second rule is supposed to capture the subsite name and pass it to the redirect URL. But when I access https://type1.myprods.com, the URL doesn’t change and I get the “site can’t be reached” error.

    I’m not able to figure out what’s wrong here. Any help?

    Thread Starter Vivek Athalye

    (@vnathalye)

    When a user accesses my site for the first time, there is a PHP notice that is getting logged.

    PHP Notice: Undefined index: pll_language

    It is coming from pll_current_language() call from wp_enqueue_scripts action.
    Any idea how to avoid it?

    Thread Starter Vivek Athalye

    (@vnathalye)

    Gr8… thanks a lot for the quick reply. This solved my problem.

    add_action( 'wp_enqueue_scripts', 'vna_enqueue_styles_scripts' );
    function vna_enqueue_styles_scripts() {
    	error_log('current lang: ' . pll_current_language());
    	error_log('prev lang: ' . $_COOKIE[ PLL_COOKIE ]);
    }

    Just to note: I first tried the above code in init action, but wasn’t getting expected results. Both current lang and prev lang were blank.
    But when I moved it to wp_enqueue_scripts action, it worked perfectly.

    Thread Starter Vivek Athalye

    (@vnathalye)

    I had to go out of town for couple of days, so I could not send a pull request. And now when I checked, a new version of WCMp is available with a different approach to handle Shipping Methods 🙂
    Well… now I’ll need to understand this new approach and rewrite my code. 😐

    Thread Starter Vivek Athalye

    (@vnathalye)

    Ok. NP.

    I think I’ve managed it. I need some time to test and do code cleanup.
    Once done will send a pull request (hopefully by tomorrow).

    Thread Starter Vivek Athalye

    (@vnathalye)

    Hi @itzmekhokan,

    Yes, I figured it out on sunday and added my custom form. But that’s just one small part of it.

    When we try to edit the custom shipping method instance, the method settings don’t get passed on to this form and this form remains empty. Moreover when we try to save the changes from this form, they don’t get saved. Both of these issues are caused by the code in vendor-shipping.js. The methods editShippingMethod and updateShippingMethod have some hardcoded logic based on if conditions such as:

    
    if (methodId == 'free_shipping') {
    ****
    }
    if (methodId == 'local_pickup') {
    ****
    }
    if (methodId == 'flat_rate') {
    ****
    }
    
    

    First of all these should have been if ... else if ... else if and then there is no logic for custom shipping method (the last else part).

    For the time being / testing purpose I’ve added the logic for custom shipping here but now I’m facing issue in WCMP_Vendor_Shipping_Method::calculate_shipping. Here also the logic is based on hardcoded method ID checking and there is no logic available for supporting custom shipping methods. So my custom shipping method’s calculate_shipping doesn’t get called at all. 🙁

    Can you plz help me with this?

    Thread Starter Vivek Athalye

    (@vnathalye)

    Further observations:
    For the same shipping zone, I added my custom shipping method twice as site admin and twice as vendor. So there are 4 instances of my custom shipping method for the given zone and their instance IDs are as shown below.

    22: added by vendor
    24: added by vendor
    84: added by site admin
    85: added by site admin

    Now the echoed text shows up thrice with the instance IDs: 84, 85 and 0.

    Thread Starter Vivek Athalye

    (@vnathalye)

    @itzmekhokan On further debugging, I see my previous understanding was wrong.

    I added 1 more shipping method (Local pickup). So now there are 3 shipping methods for the given zone, added by the vendor. But still the text appears twice only. So its not dependent on the number of shipping methods. (But it still appears for all shipping methods.)

    So to understand why its showing up twice, I echoed $this->id . ':' . $this->instance_id . ' - does this show up? ';. The instance IDs are 84 and 0. I can see that 84 is the instance ID of the custom shipping method added by site admin for the same shipping zone (which is not visible to vendor). But I could not understand what does the instance ID 0 corresponds to?

    Moreover the custom shipping method added by vendor has the instance ID 22, which is not getting displayed at all.

    Now I’m all the way more confused:

    Why is it not getting called for instance ID 22?
    Where is the instance ID 0 defined?
    Why does it get displayed for other shipping methods (Flat Rate and Local Pickup)?
    How do I avoid it getting executed multiple times?

    Thread Starter Vivek Athalye

    (@vnathalye)

    Hi @itzmekhokan,

    I tried using the hook you suggested. In my shipping method’s constructor I wrote: add_action('wcmp_vendor_shipping_methods_edit_form_fields', array($this, 'show_edit_form_fields'));

    Now whatever I’m echoing from show_edit_form_fields gets displayed on edit shipping method dialog but it appears as many times as the number of shipping methods added by the vendor. And moreover it’s appearing for each of the shipping methods.

    For example – check this screenshot: https://prnt.sc/nbbury
    The vendor has added 2 shipping methods: Flat Rate & my custom shipping method. If you see the test “does this show up?” is appearing twice at the bottom. And its appearing for Flat Rate as well.

    How do I know which shipping method is getting edited, the method ID and instance ID?

    Thread Starter Vivek Athalye

    (@vnathalye)

    Hi @dualcube,

    To understand how shipping method settings are shown in modal dialog, I’ve started implementing my own shipping method. I’m returning custom html from generate_settings_html() of my shipping method class. This html shows up for site admin (when I go to: WooCommerce > Settings > Shipping > Shipping Zones > my shipping zone > Edit my shipping method).

    But this custom HTML doesn’t show up for vendors (when I go to: Dashboard > Store Settings > Shipping > my shipping zone > Edit my shipping method). I get an empty modal dialog. What could be the reason and how do I show my custom HTML for vendors?

    Thread Starter Vivek Athalye

    (@vnathalye)

    Yes, I agree with you Dan. And I know about supports property and its values instance-settings & instance-settings-modal.

    But as I said, the WBS edit link takes the user to wp-admin/admin.php?page=wc-settings&tab=shipping&instance_id=***. This link works for site admin but doesn’t work for individual vendors. They don’t have access to page=wc-settings.

    That’s where I’m looking for your help: can we have a different page to edit the WBS rules? This page will / should be accessible by all vendors. If we can have such a link, I can tweak the multivendor plugin (myself or ask the author) to take user to that page.

    Thread Starter Vivek Athalye

    (@vnathalye)

    @dualcube One suggestion:
    Whenever a hook is removed or changed, mention it in changelog.
    Or otherwise implement a functionality like the one WooCommerce has implemented with WC_Deprecated_Hooks.
    That will avoid confusion and help developers to quickly find alternative hooks.

Viewing 15 replies - 1 through 15 (of 64 total)