I want to show the quantity available on the website's product page. I checked the web-store tab of the NetSuite item record but there seems no such field where I can populate this. Basically, I am trying to populate the stock's quantity available field.
Do I have to modify the code in tpl file for this? But the file is locked and there is read-only access to it.
The general process is to create a custom_modules folder at the same level as the project's SuiteCommerce folder and then tell the project about that folder by including it in the distro.json file and building and publishing the project
In the custom_modules folder you create a section folder (in my example named CustomItemViews#1.02)
and in that a Templates folder for your overrwritten template and also a ns.package.json where you tell SC about your overrides.
so in /custom_modules/CustomItemViews#1.02/ I have
ns.package.json
{
"gulp": {
"javascript": [
"JavaScript/*"
],
"sass": [
"Sass/*.scss"
],
"templates": [
"Templates/*"
]
}
,"overrides": {
"suitecommerce/ItemViews#1.0.2/Templates/item_views_stock.tpl": "Templates/item_views_stock.tpl",
}
}
and Templates/.
in /custom_modules/CustomItemViews#1.02/Templates I have, amongst other things not shown and paraphrased due to NS copyright,:
<p class="">
{{stockInfo.stock}}
</p>
final piece is the distro.json folder where all your custom modules are at
{
...
"modules":{
... maybe other custom modules
"custom_modules/CustomItemViews": "1.0.2",
... suitecommerce modules
}
}
Related
In Gatsby tutorial part 6, you can find multiple mentions of "node type" :
According to the API, you need to decide on two things before creating a collection route:
Which type of node to create pages from.
Which field from that node type to use in the URL.
To create a new collection route, you name your file {nodeType.field}.js, where nodeType is the type of node you want to create pages from, and field is the data field from that node type that you want to use in the URL for that page.
My aim would be to create a page tree like :
index.tsx
blog/{article.slug}.tsx
projects/{project.slug}.tsx
tags/{tag.id}.tsx
All of articles, projects and tags would be MDX files but queried on specific location, or frontmatter prop.
But I don't know how to create named node type that I should use like mdx in {mdx.slug}.js.
I even tried to add an instance of gatsby-source-filesystem with a name to use as type but it didn't work :
plugins: [
// ...
{
resolve: "gatsby-source-filesystem",
options: {
path: `${__dirname}/_data`,
name: "instances",
__key: 'instances'
}
},
"gatsby-plugin-mdx"
}
According to the docs:
gatsby-plugin-mdx automatically adds a slug field to each MDX
node, which contains a string of the filename for the .mdx file
(with the .mdx extension removed). You can see the slug field’s
value for each MDX node in GraphiQL. If you run the following query:
So you just need to use gatsby-plugin-mdx to create an slug based on the filename:
module.exports = {
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `posts`,
path: `${__dirname}/src/posts/`,
},
},
{
resolve: "gatsby-plugin-page-creator",
options: {
path: `${__dirname}/src/posts`,
},
},
`gatsby-plugin-mdx`,
],
}
Note: gatsby-plugin-page-creator may be required depending on your desired folder structure/source
Once you've set properly your folder structure, your slug field will be available (because the node will be inferred from the plugins and accessible by GraphQL) so you will be able to create pages using the Filesystem Route API like blog/{article.slug}.tsx.
Applied to your code this means that you only need to use /pages/blog/{mdx.slug}.js.
According to what you said, you will need to create several instances of gatsby-source-filesystem to create multiple sources.
Since your index.tsx won't be dynamically created, you can just directly create it under /pages folder.
I think you actually call the filename {mdx.slug}.js as in src/pages/{mdx.slug}.js.
It IS a way to tell gatsy that this file will be used for dynamic mdx.slug.
I have a question. I have a django project where I inherit a navigation bar in all my rendered html views. I want to pass a variable that records how many of certain instance exisits within my DB.
Okay so this is extremely simple if I write a query in every single function that renders an html page that {%include 'partials/navbar.html'%}, and every function does because I extend my index file which includes my navbar
So like I said it super simple to write a query within every single function and then pass this value in the context. But is there a way that is less tedious almost like an injector in angular?enter image description here
A context processor makes a piece of context available in every template, without having to manually pass it into the context of each view.
Firstly, you need to create your context processor. Create a context_processors.py inside the directory of one of your apps. For example, if you have an app called myapp, the directory should look like this (where ... represents the other files/folders inside of that app):
myapp/
...
context_processors.py
In that newly create file, add your piece of context:
def my_objects(request):
return {'all_my_objects': MyObject.objects.all()}
In your project's settings.py, you have a TEMPLATES variable. You need to add the full dotted path to the method of your context processor:
TEMPLATES = [
{
...
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'myapp.context_processors.my_objects', # <--- here
],
},
},
]
You can then use this like any other context you pass into your templates.
1. Create a file inside in your application folder: (custom_context_processor.py)
2 Inside (custom_context_processor.py)
def subject_renderer(request): return{ "key": Example.objects.all()
In setings.py
'OPTIONS':context_processors:[All the other functions.... yourappname_context_processor.subject_renderer ]
In any html template call your key value pair '{{key}}'
Please help with with the database design for the directory table. I want to give option to users to create folder or subfolder and place their files in them or so on. I have seen the Microsoft installer directory table. But I think it will make complexities when I want to get data or structure with respect to usernames.
MongoDB structure:
{
"user": "Peter",
"drive": {
"folders": {
"MyExampleFolder": {
"files": [ FileUUID, FileUUID ]
"folders": [ FolderUUID ]
}
},
"files": { ... },
}
}
You'll store the folders and files inside "drive", then all the folders go inside "folder" (where inside that you have all the same "files" and "folders" (and so on).
When I browse to a gist on gist.github.com it displays a friendly name. E.g. for
https://gist.github.com/stuartleeks/1f4e07546db69b15ade2 it shows stuartleeks/baz
This seems to be determined by the first file that it shows in the list of files for the gist, but I was wondering whether there is any way to retrieve this via the API?
Not directly, but you can get with the Gist API the JSON information associated to a gist, reusing the id of your url:
GET /gists/:id
In your case: https://api.github.com/gists/1f4e07546db69b15ade2
It includes:
"files": {
"baz": {
"filename": "baz",
and:
"owner": {
"login": "stuartleeks",
That should be enough to infer the name stuartleeks/baz.
I've been trying to customize taxonomy page template in my Drupal 6 site.
What I did was
created page-taxonomy-term.tpl.php
created node-taxonomy.tpl.php
Entered following code in template.php:
function templateNAME_preprocess_node(&$vars) {
if (arg(0) == 'taxonomy') {
$suggestions = array(
'node-taxonomy'
);
$vars['template_files'] = array_merge($vars['template_files'], $suggestions);
}
My Taxonomy page is picking up page-taxonomy-term.tpl.php correctly but it just doesn't pick up node-taxonomy.tpl.php and I tried just almost everything.
below few tips and attempts to do:
if you are working on subtheme, copy node.tpl.php from parent theme to the folder under subtheme (mandatory in drupal 6 themes).
try to check if the node-taxonomy suggestions is correctly added in
object $node. var_dump($node) inside the main node.tpl.php and check
if is present.
last tips: check the permission of the file tpl, maybe is not readable from the web server.