These are chat archives for reactioncommerce/reaction

11th
Jul 2017
Sergei
@spestushko
Jul 11 2017 11:29
Hi, Guys, what does reaction commerce use on the front-end? I assume its react.js , but a colleague of mine also told me that there is a version with angular.. which one is it? Thanks! :)
Linnette Wanjiru
@LWanjiru
Jul 11 2017 11:30

Hello everyone. I am having a little trouble following the Reaction codebase and can’t seem to trace how the price is reflected on the main product dashboard, as it doesn’t change when I effect changes in the main product. I am trying to filter products by price range. Currently, the price filter only seems to pick up on the `basic example’ range and only for the two default variants. A new product when created also doesn’t show the price on the main dashboard.

Are there any good resources/tips you could share with me that address this? The documentation and other resources I am finding do not seem to quite address the problem I am facing.

v3yr0n
@v3yr0n
Jul 11 2017 11:30
@zenweasel i keep getting this error, that was already reported on GitHub: TypeError: Cannot read property 'toString' of null at /private/var/folders/xt/h63m6n8n7d1dgqqb08mhbrvc0000gn/T/shelljs_cbde548dde55b2abcf10:10:37
Brent Hoover
@zenweasel
Jul 11 2017 11:50
Yep, we all get it
@spestushko It’s mostly React. But there’s still some Blaze left
Sergei
@spestushko
Jul 11 2017 11:57
thanks, @zenweasel !
danielpinna
@danielpinna
Jul 11 2017 14:11

@rhaix @zenweasel
Guys, thanks for the help from yesterday.

It finally managed to create a route and render a page for this route.

Incredibly simple ...

Folks,
Following the link above, I see that in the register there are several attributes (layout, registry, etc).
Where can I learn what each of them and their sets represent?
v3yr0n
@v3yr0n
Jul 11 2017 16:47
guys!
how can i make a route return json?
when called?
danielpinna
@danielpinna
Jul 11 2017 16:49
@v3yr0n
See REST API
v3yr0n
@v3yr0n
Jul 11 2017 16:50
i’ll check @danielpinna, thanks!
danielpinna
@danielpinna
Jul 11 2017 16:50
Only install meteor-rest ( meteor add simple:rest )
v3yr0n
@v3yr0n
Jul 11 2017 16:51
well, i just want one route to return json
it’s not json, it’s xml
but the funcionality is the same
danielpinna
@danielpinna
Jul 11 2017 16:51
It's json
v3yr0n
@v3yr0n
Jul 11 2017 16:52
basically i need a way to remove the layout
and return a xml string
danielpinna
@danielpinna
Jul 11 2017 16:53

step 1 - meteor add simple:rest
step 2- restart app
step 3 - call localhost:3000/publications/api-routes

Only chose one API REST and get you DATA in json

@v3yr0n You can get the json by following the steps above
v3yr0n
@v3yr0n
Jul 11 2017 17:15
yeah, but just need to send a response as xml in one route :)
danielpinna
@danielpinna
Jul 11 2017 17:18

@v3yr0n

I understand your need.
I'm also new with Reaction, it does not bring standard API exposure.
This was the way I found to expose API, however it ends up making exposure to all memso routes.
Reaction works from DDP, I still do not know how it would be to expose a single route.

Does anyone know how to answer this question?

Spencer Norman
@spencern
Jul 11 2017 17:29

Hi @danielpinna and @v3yr0n
It’s been a while since I’ve done this, and haven’t done it in a recent version of Reaction, but I’d imagine that it would still work

When I was at GetOutfitted we defined a number of JSON endpoints with https://atmospherejs.com/simple/json-routes

v3yr0n
@v3yr0n
Jul 11 2017 17:31
@spencern thanks!
but this will also do xml?
Spencer Norman
@spencern
Jul 11 2017 17:31
couldn’t say if it will do XML or not
v3yr0n
@v3yr0n
Jul 11 2017 17:32
because i’m using an external api that needs a xml response to confirm that is was correctly delivered
Spencer Norman
@spencern
Jul 11 2017 17:32
if it doesn’t out of the box, I’d imagine you could fork the json-routes project and return xml as the response, but not sure how much work that would take
there may be similar XML focused projects as well, but I haven’t used them
v3yr0n
@v3yr0n
Jul 11 2017 17:32
well, i can use js2xmlparser
and how would this json-router integrate with reaction commerce?
Spencer Norman
@spencern
Jul 11 2017 17:33
The example I’ve given shows how we integrated it in the past, but you’ll have to do some experimenting to figure out if that still works as this was on a much older version of Reaction
v3yr0n
@v3yr0n
Jul 11 2017 17:37
ok, thanks, i’ll give it a try :)
Spencer Norman
@spencern
Jul 11 2017 17:37
Good luck :) Let us know what you learn
danielpinna
@danielpinna
Jul 11 2017 17:38
@spencern Do you know where i learned about options/attributes in register.js?
v3yr0n
@v3yr0n
Jul 11 2017 17:39
sure @spencern
danielpinna
@danielpinna
Jul 11 2017 17:40

I created a new custom route and a page and now I would like to add a link to them in Reaction's administrative bar when I was logged on as an administrator.

I believe this is the configuration of this register.js file.

Spencer Norman
@spencern
Jul 11 2017 17:42
@danielpinna I’m actually not certain. I’d imagine we’ve got a section in our docs on it, but if not we should fix that asap. I know @zenweasel (who’s asleep on the other side of the world right now) has done quite a bit with plugin configuration.
@machikoyasuda is heading up our docs now and might have an idea as well.
I can try to write up a quick explainer too as I believe I’ve seen this come up before
danielpinna
@danielpinna
Jul 11 2017 17:45
@spencern Probably should have this yes somewhere in the documentation, I am new to the reaction and still not accustomed to it .....
Thanks
I will search more in documentation...
Spencer Norman
@spencern
Jul 11 2017 17:45
:+1:
Spencer Norman
@spencern
Jul 11 2017 17:53

@v3yr0n another thing you could look at would be how we use provide a different layout/template for order “PDFs” in the orders plugin

Again, you’ll probably have to do some digging and experimenting, but it’s another option that might be a way you could return XML

Spencer Norman
@spencern
Jul 11 2017 18:22
@danielpinna not sure if you’ve found anything, but a good place to start might be the registry/packages schema
danielpinna
@danielpinna
Jul 11 2017 18:52

Guys, I've created 3 routes in a custom plugin.

I called the routes through the tag (a href), it worked, but it always causes refresh on the page. Probably by the way I called it with the tag (a href).

What would be the correct way to call the new routes without causing refresh on the page?

@spencern I did not find anything, I'll take a look at this link. Thank you!
Jeremy Shimko
@jshimko
Jul 11 2017 18:59
You can use Router.go("/path") in a click handler or React Router’s <Link to="/path" /> component
danielpinna
@danielpinna
Jul 11 2017 19:00
@jshimko Thanks!
Kenneth Beartusk
@beartusk
Jul 11 2017 20:00

@jshimko @zenweasel I'm trying to deploy a build of reaction. I tried the build command once as root user and it failed. I figured it might have been because I was root user, so i'm trying to do it from a non-root user now, but I am getting this error.

[....@.... reaction]$ reaction build test

Setting up plugin imports...

Failed to reset plugins file at /home/sweetgra/reaction/client/plugins.js
[....@.... reaction]$

Any suggestions

Janus Reith
@janus-reith
Jul 11 2017 21:25

I have an question, propably related to ProductDetailContainer:
Due to the way my shop works, when a variant is selected, i need to auto point to the first option(Like, clicking the variant and then manually clicking the option)

How can I accomplis this the easiest way?
In the PD Container there is: const selectedVariant = ReactionProduct.selectedVariant(), which I also use in several other methods
But changing selectedVariant to the first option probably would work properly, as the real product selected would still be the top variant

@jshimko , @spencern , @kieckhafer would appreciate your ideas :)
Janus Reith
@janus-reith
Jul 11 2017 21:34
Reason: My variants all have an image, but I modified the code so they are just shown inside of the variant buttons, just like it is done for the options.
They should however never show up in the MediaGalleryContainer, which I already solved by checking the ancestors length of selectedVariant and set mediaArray to [] if it is a top variant.
I just dont want the MediaGalleryContainer to ever be empty, and therefore need to auto select the first option.
My options also have images, but they should show in the mediagallery container when selected(which also works as expected)
  • to the first option probably would NOT work
Spencer Norman
@spencern
Jul 11 2017 21:40
Hi @janus-reith - I’ve accomplished this by setting selectedVariant as the first option of the first variant in the past. You can use filters to ensure that you’re selecting a variant that has images and has inventory if you like. I don’t have access to the code I’ve written before anymore, but it was for RC v0.17, so it wouldn’t translate to the new React PDP perfectly anyway. I think you’re on the right track though
Janus Reith
@janus-reith
Jul 11 2017 21:41
hmm, okay, i thought this would not work because of at least those 2 things:
  1. the router url would still point to the top variant
  1. ReactionProduct.selectedVariant() would still return the top variant, although selectedVariant is already the child/option
or did i get that wrong?
Spencer Norman
@spencern
Jul 11 2017 21:45

when you update the selectedVariant you should be able to also update the router (Router.go should work I think)

If you use ReactionProduct.setCurrentVariant I think that should cause selectedVariant() to return the correct variant

It’s been a while since I’ve done this, so you may have to dig a bit, but you should be able to do what you’re after without too much trouble
Janus Reith
@janus-reith
Jul 11 2017 21:53
interesting, the ReactionProduct.setCurrentVariant method is what i was missing
Thank you for the help, i guess with a combination of these 3 things I should be able to solve this
Janus Reith
@janus-reith
Jul 11 2017 22:10
messed up something somewhere. I create an Array of options, and
selectedVariant = optionsArray[0]; also works as expected: The first child is shown in the mediagallerycontainer etc, but actually the topvariant is selected.
But ReactionProduct.setCurrentVariant(optionsArray[0]._id) results in a weird loop
Janus Reith
@janus-reith
Jul 11 2017 22:22
weird, Reaction.Router.go(routerpath) creates a similar loop like when using setCurrentVariant Im starting to guess this is somehow related to my usage of these functions in the react-komposer compose function
Kenneth Beartusk
@beartusk
Jul 11 2017 23:12

I went around my first problem by initializing a new reaction solution.
Now, I am encountering this error while trying to build a reaction deployment from a non-root user. It seems the build cannot even initialize since the user does not have permission to /var/run/docker.sock. But, when I tried doing a build as a root user I also ran into an error. I am very confused. @jshimko @zenweasel any ideas?


[user@myserver reaction_test]$ reaction build testr

Setting up plugin imports...

Setting up style imports...

Starting Docker build...

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.30/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=test5&target=&ulimits=null: dial unix /var/run/docker.sock: connect: permission denied

Error: Docker build failed. Exiting.
[user@myserver reaction]$