Closed christiandesantis closed 4 years ago
Hey @christiandesantis,
Please use our bagisto version v1.1.0 and Laravel Aliexpress Dropship v1.1.0, which will resolve your issues. And, the issue you are currently facing is due to the laravel fire() method is an alias to the dispatch() method. The renaming of this method started way back in the laravel 5.3 to 5.4 upgrade.
Thank you so much, problem solved! I just needed to use the Laravel Aliexpress Dropship v1.1.0, There was no need to downgrade my bagisto version to v1.1.0
One las thing, when I try to run "php artisan dropship:product:update" in my production server it throws this error: In AliExpressProductRepository.php line 450: Undefined variable: skuProducts
Is this error going to prevent the inventiory and price updates in the future? This is the function where the problem is coming from in packages/Webkul/Dropship/src/Repositories/AliExpressProductRepository.php:
public function getAliExpressSkuProducts($htmlObj)
{
$xp = new \DOMXPath($htmlObj);
$scripts = $xp->query("//script");
foreach ($scripts as $script) {
if (preg_match('#var skuProducts=(.*?)];#', $script->nodeValue, $matches)) {
$skuProducts = json_decode($matches[1] . ']');
}
}
return $skuProducts;
}
So the variable $skuProducts is not being declared because for some reason the if statement's condition is not being accomplished. Is there a working version of this function that I can replace it with? Or is it unnecessary to correct this?
@christiandesantis, not able to generate the issue. Did you follow the same steps as described in readme file
Yes I did follow exactly the same steps, this is what I'm getting in my terminal:
Please I'd like to know what would be de consequences of deciding to move forward in this project without dealing with this problem, or even better if there might be a solution for this. Thank you
@christiandesantis , Please take a latest pull from branch https://github.com/bagisto/laravel-aliexpress-dropship/tree/v1.1.0
I just did that and it's still not working, I'm going to go ahead and declare the $skuProducts variable before the foreach where it is referenced, like this:
public function getAliExpressSkuProducts($htmlObj)
{
$xp = new \DOMXPath($htmlObj);
$scripts = $xp->query("//script");
$skuProducts = []; // Here
foreach ($scripts as $script) {
if (preg_match('#window.runParams = { data: (.*), csrfToken#', trim(preg_replace('/\s\s+/', ' ', $script->nodeValue)), $matches)) {
$skuProducts = json_decode($matches[1]);
}
}
return $skuProducts;
}
This way I stop getting the error because the $skuProducts variable that this function returns is declared even when the code inside the foreach where this variable was supposed to be declared isn't been executed. (Note: the foreach isn't being executed because for some reason the $scripts variable is empty or doesn't have elements in its array).
I believe this isn't the right solution for this problem, because if this variable was declared only inside the foreach and the if statement I guess it was for a reason... So probably my current solution will result in this function returning the initial empty array every time.
Please, if you can find the REAL solution for the problem let me know through this issue or to any of my emails christiandesantisc@icloud.com christian.constantino98@gmail.com
Thank you
You doesn't have latest pull, please take a pull. Refer https://github.com/bagisto/laravel-aliexpress-dropship/blob/v1.1.0/packages/Webkul/Dropship/src/Repositories/AliExpressProductRepository.php#L473
You doesn't have latest pull, please take a pull. Refer https://github.com/bagisto/laravel-aliexpress-dropship/blob/v1.1.0/packages/Webkul/Dropship/src/Repositories/AliExpressProductRepository.php#L473
All fixed, thank you!
Chrome extension is not working, in version 0.1.0 (the one that is currently in chrome store) doesn't show the import product button, and I also downloaded 0.1.1 version from Github and installed it to chrome and it does show the import product button but when I click on this button it stays loading forever and when I check the chrome console It shows CORS errors: "Access to XMLHttpRequest at 'https://m.aliexpress.com/item/4000039844416.html' from origin 'https://www.aliexpress.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."
I made sure that CORS is enabled in my Bagisto Laravel app and I kept getting the same problem, so I tried installing a CORS chrome extension and then the product form did show up when I tried to import the product, but when I click submit I get a lot of similar errors in console and out of the console a red notification that says: "Method Illuminate\Events\Dispatcher::fire does not exist."
First screenshot is in version 0.1.0 that doesn't show the import button, and the other two screen shots are in version 0.1.1 where I get the errors to submit the form to my bagisto web app.