butopea / vue-storefront-api-opencart2-platform

OpenCart 2 Platform for Vue Storefront API
MIT License
6 stars 6 forks source link

looks like this module does not work with VSF API version > 1.12.1 #1

Open revington opened 3 years ago

revington commented 3 years ago

Problem is that https://github.com/vuestorefront/vue-storefront-api/tree/v1.12.2/src/lib does no longer have an ./src/lib/taxcalc.js file

Trace: Error: Cannot find module '../../lib/taxcalc'                                                                           
Require stack:                                                                                                                 
- /home/pedro/work/super-shop/vue/vue-storefront-api/src/platform/opencart2/tax.js                                            
- /home/pedro/work/super-shop/vue/vue-storefront-api/src/platform/factory.ts                                                  
- /home/pedro/work/super-shop/vue/vue-storefront-api/src/api/order.ts                                                         
- /home/pedro/work/super-shop/vue/vue-storefront-api/src/api/index.ts                                                         
- /home/pedro/work/super-shop/vue/vue-storefront-api/src/index.ts                                                             
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)                                                
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)                                                           
    at Module.require (internal/modules/cjs/loader.js:1025:19)                                                                 
    at require (internal/modules/cjs/helpers.js:72:18)                                                                         
    at Object.<anonymous> (/home/pedro/work/super-shop/vue/vue-storefront-api/src/platform/opencart2/tax.js:2:1)              
    at Module._compile (internal/modules/cjs/loader.js:1137:30)                                                                
    at Module.m._compile (/home/pedro/work/super-shop/vue/vue-storefront-api/node_modules/ts-node/src/index.ts:473:23)        
    at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)                                                         
    at Object.require.extensions.<computed> [as .js] (/home/pedro/work/super-shop/vue/vue-storefront-api/node_modules/ts-node/
src/index.ts:476:12)                                                                                                           
    at Module.load (internal/modules/cjs/loader.js:985:32)                                                                     
    at Object.apiError (/home/pedro/work/super-shop/vue/vue-storefront-api/src/lib/util.js:97:12)                             
    at /home/pedro/work/super-shop/vue/vue-storefront-api/src/api/catalog.ts:192:9                                            
    at Generator.next (<anonymous>)                                                                                            
    at /home/pedro/work/super-shop/vue/vue-storefront-api/src/api/catalog.ts:8:71                                             
    at new Promise (<anonymous>)                                                                                               
    at __awaiter (/home/pedro/work/super-shop/vue/vue-storefront-api/src/api/catalog.ts:4:12)                                 
    at Request._callback (/home/pedro/work/super-shop/vue/vue-storefront-api/src/api/catalog.ts:141:39)                       
    at Request.self.callback (/home/pedro/work/super-shop/vue/vue-storefront-api/node_modules/request/request.js:185:22)      
    at Request.emit (events.js:315:20)                                                                                         
    at Request.<anonymous> (/home/pedro/work/super-shop/vue/vue-storefront-api/node_modules/request/request.js:1161:10)       
---                                                                                                                                
themreza commented 3 years ago

Good find. We haven't tested the connector beyond v1.11, but I took a quick look in https://github.com/vuestorefront/vue-storefront-api/search?q=checkIfTaxWithUserGroupIsActive and it seems like the functions that are imported from that missing file are now in vsf-utilities.

I recommend cloning this repository, making a new branch, and changing the faulty line to this:

https://github.com/vuestorefront/vue-storefront-api/blob/51f9e333220e65fbe7ef4ec0e2fbfd3576468730/src/platform/magento1/tax.js#L2

If it works out for you it would be awesome if you make a PR so others can use this on v1.12 :)