Public Ticket #3426686

get_vendor_id_by_url always returns zero

Closed
Comments
2 Tickets 2
Marceline Devey started the conversation 3 years ago on July 31, 2023 at 3:23pm

hello good people of the MarketKing Land!

i have a question about the get_vendor_id_by_url function.

global $wp;
$current_url = home_url( add_query_arg( array(), $wp->request ) );
echo marketking()->get_vendor_id_by_url($current_url);

say i have 3 vendor store, 

  1. http://toystore.com/shop/one
  2. http://toystore.com/shop/two
  3. http://toystore.com/shop/three

when i browse all three store, the get_vendor_id_by_url always returns 0. i wonder what went wrong :

Love, Marcie.

2,762
KingsPlugins replied 3 years ago on July 31, 2023 at 5:13pm

Hi Marceline,

Similar to the ticket here https://support.kingsplugins.com/ticket/3426666/ , these functions do not use the complete URL, they only use the unique URL ending of each vendor.


So please call it like this:

marketking()->get_vendor_id_by_url('one'); // correct

rather than:

marketking()->get_vendor_id_by_url('http://toystore.com/shop/one'); // incorrect


Kind regards,

Stefan

Sign In