Custom script is deactivated

Hi guys
i am new to sharetribe i made local marketplace by sharetribe go community version here is link https://secondand.net but when i try to add some custom coding inside admin panel it is deactivated i cant use it pls anybody help me how i can enable custom coding feature.

Good to hear about your marketplace!

The Custom script feature should be enabled by default but if this is not the case, you could try something like the following to create a “plan” that enables that feature:

PlanService::Store::Plan::PlanModel.create(community_id: 1, status: "active", features: {"deletable":false, "admin_email"=>true, "whitelabel"=>true, "footer"=>true, "landing_page":true, "custom_script":true}, expires_at: Time.current + 90.years)

I’d like to clarify that this is entered in the rails console, accessed with something like this

rails console

when in your project’s main directory.

1 Like

thanks for your reply. the command activates custom scripts but “save changes” button is deactivated. when i write custom code save button not work. pls help
and my marketplace domain name is changed to https://kejole.com

Hmm that sounds unusual. The “Save changes” button gets enabled only if some content is added to the input fields. If you type something, anything, in the input fields, does it not enable that save button?

This needs some JavaScript to work smoothly. Do you have everything enabled on that front? Does the save changes button work in other pages of the Admin panel?

yes others save button is work, only custom scripts button is disabled. even after i write some codes it stays disabled. what is the potential problem

Sorry to hear that. Unfortunately, I’m not able to reproduce this situation, so that’s a bit challenging.

Hopefully, someone who has experienced a similar situation will share their solution!

is there another way to add custom scripts on head. if there is a way to add to database.

Sure, you can always add things straight to the database, in the following fields:

  • communities.custom_head_script
  • communities.custom_body_script
  • communities.custom_css_script

thanks for the answer. to make it clear do i need to add or tags or just input without head tag? and lastly, if i use insert keyword there is not null fields which i have to insert with custom_head_scripts what to insert in that fields?

do i need to add or tags or just input without head tag

You should not add the tags. The <head> and </head> will be inserted automatically.

if i use insert keyword there is not null fields which i have to insert with custom_head_scripts what to insert in that fields?

I’m not sure to understand your question. Can you tell us a bit more?

if i use “INSERT INTO communities.custom_head_script some scripts…” there is another fields like id (id is auto increment), but some fields not null. what to insert in those fields

can i insert in only custom_head_scripts or body_scripts column without inserting any data in other columns?

Alright, thanks for clarifying.

Indeed, you should not insert but UPDATE, if you already have some row created for your marketplace. “Insert” is about adding a new row, while “update” is about updating the value for one of the fields.

If you are not familiar with SQL, maybe you could use a client that allows you to make edits directly (be careful, though, as it’s easy to make mistakes!). Sequel Pro or Heidi SQL are good options.

thanks dear. it works.
sharetribe is awesome marketplace, and its community is kind to help others.

1 Like