These are chat archives for reactioncommerce/reaction

3rd
Oct 2016
3Maestros
@3Maestros
Oct 03 2016 00:15
Yes
Brent Hoover
@zenweasel
Oct 03 2016 00:22
Do you have layoutFooter referenced in your template?
3Maestros
@3Maestros
Oct 03 2016 01:19
no ...
do I have to when I set it as INDEX_OPTIONS..
Brent Hoover
@zenweasel
Oct 03 2016 01:21
No, you shouldn't
Hai Nguyen
@nguphoha
Oct 03 2016 02:40
@zenweasel Follow the guide https://docs.reactioncommerce.com/reaction-docs/development/creating-a-plugin#removing-fields-from-a-schema. But I can remove and add new schema. How can I override the core schema and add new schema . Plz help me.
Brent Hoover
@zenweasel
Oct 03 2016 02:42
You can add a new schema by just adding it. Just declare it and make sure it’s imported with the rest of your code.
What do you mean by “override”?
You can add/remove/replace fields using the instructions
Hai Nguyen
@nguphoha
Oct 03 2016 02:43
I followed the instructions, but it's not work
maybe I did incorrect
Brent Hoover
@zenweasel
Oct 03 2016 02:44
Can you give me more details about what’s not working?
Hai Nguyen
@nguphoha
Oct 03 2016 02:45
I didn't see any change of schema
Brent Hoover
@zenweasel
Oct 03 2016 02:47
is the file that modifying the schema being imported?
Hai Nguyen
@nguphoha
Oct 03 2016 02:55
Like the instruction, I created a lib directory in the beesknees package and create a file called schemas.js. And then, I made a copy of the Account schema, remove the note field.
and then add this line "import { Accounts } from "lib/collections";
import { Accounts as AccountsSchema } from "lib/collections/schemas";
Accounts.attachSchema(AccountsSchema, {replace: true});" to schemas.js file
Brent Hoover
@zenweasel
Oct 03 2016 02:56
You will also need to import that file. " In order for this schema to be loaded however, you will need to add imports in the main.js files for both client and server."
however reading this over again I am not entirely sure that this method works anymore.
Hai Nguyen
@nguphoha
Oct 03 2016 02:58
you mean, I must create main.js in the client, server directory ?
Brent Hoover
@zenweasel
Oct 03 2016 02:58
in the past the schemas were globals that could be replaced, however, now that they get imported directly, just creating a new version won’t replace the old one
Hai Nguyen
@nguphoha
Oct 03 2016 03:03
Do You mean, the old schema won't be replaced by the new one ?
Brent Hoover
@zenweasel
Oct 03 2016 03:03
I think everywhere it is directly imported (which should be everywhere in existing code) your new schema will not be used.
If you are only using your new schema in your own code, that would work fine
I think we talk about this issue here: reactioncommerce/reaction#1296
Hai Nguyen
@nguphoha
Oct 03 2016 03:16
Thanks Brent. But I don't understand how to add new schema (not extend)
Brent Hoover
@zenweasel
Oct 03 2016 03:17
If you just want to add a schema, just create it and then import it wherever you need it
what is the schema you are trying to create?
Hai Nguyen
@nguphoha
Oct 03 2016 03:19
I am trying to create "Product category" schema
Brent Hoover
@zenweasel
Oct 03 2016 03:21
you should be able to add that to your plugin and then import it from there
Hai Nguyen
@nguphoha
Oct 03 2016 03:28
as you said, I need only declare my schema in schemas.js file, and import it from main.js of plugins.

Do not export like this: export const Accounts = new Mongo.Collection("Accounts");

Accounts.attachSchema(Schemas.Accounts);

Brent Hoover
@zenweasel
Oct 03 2016 03:31
that’s two separate things if you want to create a Collection
Schemas != Collections although they are very related
Hai Nguyen
@nguphoha
Oct 03 2016 03:36
I wanna create new schema and new collections to storage the data. How can I do.
Brent Hoover
@zenweasel
Oct 03 2016 03:37
Have you read the Meteor tutorials about collections?
Hai Nguyen
@nguphoha
Oct 03 2016 03:38
not yet
Brent Hoover
@zenweasel
Oct 03 2016 03:38
but basically there’s not much more to creating a collection that what you already did there:
const Categories = new Mongo.Collection(“Categories”);
then attach your schema to the collection
normally we create a collections.js file for collections
Hai Nguyen
@nguphoha
Oct 03 2016 03:41
So I must add new code create collection into that file ??
Brent Hoover
@zenweasel
Oct 03 2016 03:42
you will want to create a collections.js file with pretty much just that one-liner for now. Plus import the schema and attach it
import { CategorySchema } from “./schemas”;

export const Categories = new Mongo.Collection(“Categories”);
Categories.attachSchema(CategorySchema);
Hai Nguyen
@nguphoha
Oct 03 2016 03:47
Is the collections.js in the lib or lib\collections directory ?
Brent Hoover
@zenweasel
Oct 03 2016 03:50
it’s just a matter of style, depending on how many collections you expect to be creating
the name of the file has no special meaning, it’s just how we organize things
Hai Nguyen
@nguphoha
Oct 03 2016 03:55
OK. Does RC use index.js as entry point, like main.js of meteor
Brent Hoover
@zenweasel
Oct 03 2016 03:56
index.js is a standard file for modules, it’s actually an ES6 standard
RC is built on Meteor, so if you talking about the file for a built application then yes.
Hai Nguyen
@nguphoha
Oct 03 2016 04:03
I've just test with your instruction above, but I didn't see Categories collections to created in the mongodb
Do you have example on the github ?
Brent Hoover
@zenweasel
Oct 03 2016 04:04
is that file being imported somewhere?
the collection will not be created until the first time it’s used
Hai Nguyen
@nguphoha
Oct 03 2016 04:06
Where I should import ? In the server/index.js file ?
Brent Hoover
@zenweasel
Oct 03 2016 04:06
Collections probably need to be both client and server, so they should probably be in a lib directory
just for the sake of being explcit, create a lib/collections directory. Place the collection.js file in there and create an index.js file that looks similar to this
https://github.com/reactioncommerce/reaction/blob/dbbee9806813deebe1f659583c777c2f368fd24c/lib/collections/index.js#L1-L1
then import in both the client and server index files
Hai Nguyen
@nguphoha
Oct 03 2016 04:16
Is the lib directory in the my custom plugins ?
Brent Hoover
@zenweasel
Oct 03 2016 04:17
yes
Hai Nguyen
@nguphoha
Oct 03 2016 04:17
I have export * from "./collections"; from lib/collections/index.js, and then I `import {Categories} from "/lib/collections";' in both the client and server index files
Brent Hoover
@zenweasel
Oct 03 2016 04:17
things in client or server directories only run on client or server, but lib runs on both
your collection file is called index.js?
Hai Nguyen
@nguphoha
Oct 03 2016 04:21
Yes, the collection file is called from lib/collections/index.js by export * from "./collections";
is it right ?
Brent Hoover
@zenweasel
Oct 03 2016 04:21
No. index files should only contain imports and exports
Sorry, I need to step away for a bit
Brent Hoover
@zenweasel
Oct 03 2016 04:45
sorry I may have made this all too complicated for what you want to do
Hai Nguyen
@nguphoha
Oct 03 2016 04:48
Could you add example about what I want to do into the "reaction example plugin" on the github (https://github.com/reactioncommerce/reaction-example-plugin)
I thinks, it's the easier way that I can understand
Brent Hoover
@zenweasel
Oct 03 2016 04:49
btw is there a reason you want to use categories instead of tags?
Hai Nguyen
@nguphoha
Oct 03 2016 04:53
My website like this site: https://silkroll.com, there are both tags and categories information. And there are some feature that RC is not support, that's a reason I want to add new schema, new collection
Brent Hoover
@zenweasel
Oct 03 2016 05:05
Ok, I pushed a branch called brent-schema-example to the reaction-example-plugin
it just includes creating a collection
Robomongo_0_9_0-RC9.png
Creating a schema is explained in the docs for simple-schema or just look at the examples in the project
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 05:30
@himanshukhona_twitter
Hello All - So I did install the example theme, however it did not take effect. I also understood the way it works now but reaction is not picking up the new theme
this shouldnt be very difficult. Tried overriding variables. but it is still not picking up
Brent Hoover
@zenweasel
Oct 03 2016 05:31
have you run reaction reset?
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 05:47
Nope..should I try the same?
Brent Hoover
@zenweasel
Oct 03 2016 05:48
Yes, changes to the registry will not take affect until you reset
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 05:48
It asks to delete all node modules
which I said no? ;)
Brent Hoover
@zenweasel
Oct 03 2016 05:48
yes
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 05:49

reset: Meteor is running.

This command does not work while Meteor is running your application. Exit the
running Meteor development server.
Done!

i did reaction stop
does it not stop meteor internally?
Brent Hoover
@zenweasel
Oct 03 2016 05:49
there is no reaction stop
No. You need to stop Reaction
Hai Nguyen
@nguphoha
Oct 03 2016 06:51
@zenweasel Thanks for your help and example code. It's very helpfull for me and help me more understand.
Brent Hoover
@zenweasel
Oct 03 2016 06:52
Great. Good to hear
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 06:57
That did help. Thank you @zenweasel
Brent Hoover
@zenweasel
Oct 03 2016 06:58
:+1:
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 07:03
@zenweasel I tried installing meteor add reactioncommerce:bootstrap-theme
it did not create any directory named bootstrap any ideas?
Brent Hoover
@zenweasel
Oct 03 2016 07:05
RC no longer uses package. You need to install plugins
Packages are being phased out of Meteor
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 07:07
SO is there a theme other then example theme that I can try?
Brent Hoover
@zenweasel
Oct 03 2016 07:08
No, that’s all we have right now
Himanshu Khona
@himanshukhona_twitter
Oct 03 2016 07:31
got it.
Spencer Norman
@spencern
Oct 03 2016 23:26

Hey @EpifaniaCollection - I’ve been out of town and away from my computer for the last few days, but back now. I’d be happy to point you in the right direction as to how we added a carousel modal for our site. We have changed a significant amount of the product detail page code though.

Also to whoever was poking around, We are still on the 0.15.x branch of RC.

Additionally that link that I sent out in the PR for the phantomjs fix is no longer available on our staging server as we recently reset our products in preparation for an upcoming new product launch. I’ll plan to update that link once we have a new example.