These are chat archives for reactioncommerce/reaction

28th
Apr 2017
Quaid e azam college
@Qcetswl_twitter
Apr 28 2017 06:45
Hello
anybody is here for helping me about this new platform ?
Janus Reith
@janus-reith
Apr 28 2017 07:19
Is there a var to reference to the root of my plugin dir?
Like there is {} for the root of the reaction project
Claudio Savino
@foxhound87
Apr 28 2017 07:49
Hello, I’m using reaction for the first time, using the paypal express, the payment process will finish on the paypal website or can be done without leaving the site? thanks
Janus Reith
@janus-reith
Apr 28 2017 10:57

Did someone modify a pdp template yet to have another layer of ChildVariants?

I guess it should be easy for someone who is more advanced in react, but I'm still struggling...

Janus Reith
@janus-reith
Apr 28 2017 11:05
Hmm lets give it a try, I guess this could be done in less than an hour for someone who knows both react and the reaction code,
so how about 40$ for someone who can help me out? (Hope this is not considered insulting...)
or someone maybe already did it and would share the code :)
Janus Reith
@janus-reith
Apr 28 2017 12:09
trying it myself again...

In this part:
export function getChildVariants() {
const childVariants = [];
const variants = ReactionProduct.getVariants();
if (variants.length > 0) {
const current = ReactionProduct.selectedVariant();

if (!current) {
  return [];
}

if (current.ancestors.length === 1) {
  variants.map(variant => {
    if (typeof variant.ancestors[1] === "string" &&
      variant.ancestors[1] === current._id &&
      variant.optionTitle &&
      variant.type !== "inventory") {
      childVariants.push(variant);
    }
  });
} else {
  // TODO not sure we need this part...
  variants.map(variant => {
    if (typeof variant.ancestors[1] === "string" &&
      variant.ancestors.length === current.ancestors.length &&
      variant.ancestors[1] === current.ancestors[1] &&
      variant.optionTitle
    ) {
      childVariants.push(variant);
    }
  });
}

return childVariants;

}

return null;
}

I wonder what to modify, to get the childs, child instead
To my understanging, the part if (current.ancestors.length === 1) would actually mean that it is a Variant, not a ChildVariant? As ChildVariants in the db have 2 ancestors
Janus Reith
@janus-reith
Apr 28 2017 12:15
BUt for the else part it says not sure if needed - I am a bit confused
Dennis Öhman
@madsoulswe
Apr 28 2017 12:19
Hi, do anyone have an way to override _id in cart/order-simplescheme to make it an incremental number? =) The client, customers and third part deliverer hates the random ids =/
Janus Reith
@janus-reith
Apr 28 2017 12:19
FYI, this is the /client/selectors/variants.js file of product-detail-simple
Janus Reith
@janus-reith
Apr 28 2017 12:51

Ah, I think I get it now:

It has to be 1, as it is about the current selected Variant.
It then iterates though all variants, whose second field in the ancestors array(ancestors[1]) matches the id of the current selected Variant + other checks, and pushed them to the childVariants Array

Janus Reith
@janus-reith
Apr 28 2017 12:57
So, if i wanted to implement a getChildVariantsChild method (stupid name, i know),
I would have to do a part: (current.ancestors.length === 2), in order to determine a selected variant as child.
And to keep up with the ancestors layers scheme, Id have to search for other variants, whose ancestors[2] field matches the id of the current id., as those childs' childvariant would have an ancestors scheme of [productid, variantid, childvariantid]
Ok I have to idea why im writing down all of this here, but as there were some other people looking for the same thing, it might he informative
*no
Janus Reith
@janus-reith
Apr 28 2017 13:04
Implemented it, and created a variant with 3 ancestor layers in the db - It works!
Just a few bugs...
Janus Reith
@janus-reith
Apr 28 2017 13:19
e.g. my secondlayer child variant was also showing as regular child variant, as its ancestors[1] field still matched the main variant id.
I circumvented this by adding a variant.ancestors.length < 3 && line to the if statement, but I wonder if this is such an elegant solution,
or if i should change the way I use my ancestors array for the childvariant childs
Janus Reith
@janus-reith
Apr 28 2017 13:33
Just have to figure out now why it disapperas as soon as i click on it..
terrelltechsup
@terrelltechsup
Apr 28 2017 14:17
just a couple of comments on the quantity input and add to cart button. should probably either separate the two out of the same div or add some margin between the two. Make the input field larger and increase the weight of the font. Also the numbers get kind of lost in the green. The add to cart button probably doesn't really need to be full width.
Janus Reith
@janus-reith
Apr 28 2017 17:01
Lol now I was able to make a lot of changes to the product template, and still struggle to show my footer on the ProductPage :D
terrelltechsup
@terrelltechsup
Apr 28 2017 18:36
stripe plugin: are there plans to save the payment token in the user profile if it exists?
finseth
@finseth
Apr 28 2017 19:55
hi guys, which node version should I use for reaction commerce?
nevermind, found the version in the base dockerfile