Where can I find the code for 'salespricehtml' in NetSuite? - schema

Where can I find the code for 'salespricehtml' or 'addtocarthtml' in NetSuite?
I am trying to add Schema.org Microdata on my website's product pages, especially for the price, but the quantity amounts and prices are being displayed on the website using the tag/name 'salespricehtml' like so <%=getCurrentAttribute('item','salespricehtml')%>. If you can help, it would be greatly appreciated! :)

Here is my code:
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<h3>
<span itemprop="priceCurrency" content="AUD">$</span><span itemprop="price" content="<%=getCurrentAttribute("item","salesPrice")%>">
<script language="javascript">
salesPriceRaw('<%=getCurrentAttribute("item","salesPrice")%>');
</script>
</span>
<small>
<script language="javascript">
gstHtml('<%=getCurrentAttribute("item","salestaxcode")%>');
</script>
</small>
<span itemprop="availability" content="In stock"></span>
</h3>
</div>
With the following script in the head to format tax info and comply with microdata standards as closely as possible:
<script type="text/javascript">
function salesPriceRaw (salesPrice) {
var price = salesPrice.replace('$', '');
document.write(price);
}
function gstHtml (gst) {
if (gst == 'GST:TS-AU') {
document.write(' + GST ');
} else {
document.write('(GST Exempt) ');
}
}
</script>
It's a hack really, but it works. In essence you should remove the html part from your getCurrentAttribute tag. Hope this helps!

Related

MVC Express - Data does not carry over in view once form is submitted

I am working on a very basic weather app to learn MVC architecture. However, I am having an issue with my page reloading once I submit the form and then data from that submission not coming over into the next newly rendered page.
Most of my logic for my page is in my controller.js file. In my view I have a form where the user fills in a city, and then my getWeather function makes an API call where it gets the city's temperature. From there my controller.js should re-render the index page, but pass in the string It is currently ${temp} °F in ${city}.
At least, that's how its supposed to work. Unfortunately when the page reloads the weather const is null and I then have my function catch the error and give me the message "that city is not available".
I have tested my API to make sure that it is correctly retrieving the data, by console.logging the res object, and I am getting that perfectly.
Also, I should note I bring in Weather function from my model. The only thing it does is test to see if the user inputted anything into the form and if they didn't it creates the error "Please enter the name of the city." I don't think it is the source of my issue or the fix for it.
I guess what I'm looking for is a way to prevent my page from reloading when I submit the form, or a way to not lose the data in my function when the page reloads. Any help would be greatly appreciated!
const axios = require('axios')
const API_KEY= "8d130a4fe5369b01d1fe629bccbe0926";
const Weather = require("../model/Weather")
exports.renderHomePAge = (req, res) => {
res.render("index")
}
exports.getWeather = (req, res, ) => {
const city = req.body.city
const url = `http://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=imperial`
const weather = new Weather(city)
weather.validateUserInput()
if(weather.errors.length){
res.render("index", {error: weather.errors.toString()})
} else {
axios.get(url)
.then((response)=>{
// console.log(response)
const {temp} = response.data.main
const {city} = response.data.city
res.render("index", {
weather: `It is currently ${temp} °F in ${city}.`
})
})
.catch((err) =>{
console.log(err)
res.render("index", {
weather: `That city is not avaible`
})
})
}
}
exports.renderAboutPAge = (req, res) => {
res.render("About")
}
I don't think its neccessary for this issue, but just incase here is my index.hbs file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Weather | Home</title>
<!-- Bootstrap core CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
</ul>
</div>
</nav>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center main">
<div>
<h1 class="mt-5">MVC Weather Finder</h1>
<p class="lead">Enter the name of the city and press search!</p>
</div>
<div>
<form action="/" method="post">
<input name="city" type="text">
<button>Go!</button>
</form>
<div class="mt-3">
{{weather}}
{{error}}
</div>
</div>
</div>
</div>
</div>
</body>
</html>
It turns out I was pulling data from my response object incorrectly and that was causing the issue.

Page not re-rendering when data is updated -- Vue.js

Can't get why the app is not re-rendering when data is updated using method, can anyone see what's the issue? thanks!
On clicking the button, selectedPage is updating using the changePage method, but nothing is changing on the page (in the Vue dev tool I can see that selectedPage is changing correctly)
var app = new Vue({
el: '#app',
data: {
showMain: false,
isReader: true,
selectedPage: [0,0],
books: [
{
id: 0,
name: 'איה פלוטו',
image: 'https://upload.wikimedia.org/wikipedia/he/f/f3/%D7%90%D7%99%D7%94_%D7%A4%D7%9C%D7%95%D7%98%D7%95.jpg',
pageList: [
{id: 0, text: [',פלוטו כלבלב מקיבוץ מגידו','יש לו הכל, חלב ועצם','זה טוב ויפה, אבל בעצם','נמאס לו לשבת כך לבדו'], image: './images/wheres_pluto/page_1.jpeg'},
{id: 1, text: ['lived a princes in a big castle'], image: './images/wheres_pluto/page_2.jpeg'},
{id: 2, text: ['the END'], image: './images/wheres_pluto/page_3.jpeg'}
]
},
{
id: 1,
name: 'ספר שני',
pageList:[]
}
],
},
methods: {
changePage: function(event){
if(event == 'next'){
this.selectedPage[1] = this.selectedPage[1] + 1
} else {
this.selectedPage[1] = this.selectedPage[1] - 1
}
console.log(this.selectedPage)
}
}
})
The html:
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght#100;300;400;500&display=swap" rel="stylesheet">
</head>
<body>
<div id='app'>
<!-- book selection page -->
<div class='page app-page' v-show="showMain">
<div class='book-list' v-for="book in books" :book='book.name'>{{book.name}}
<img :src='book.image' />
</div>
</div>
<!-- Book -->
<div class="book" v-for="book in books" v-if='book.id == selectedPage[0]' :key=book.id>
<div class="book-page" v-for="(page,index) in book.pageList" v-if='book.id == selectedPage[0] && book.pageList[index].id == selectedPage[1]'>
<!-- Video component -->
<div class="video">VIDEO HERE</div>
<!-- Reader's page -->
<div class="page reader-page" v-if="isReader" :key = page.id>
<div class="main-text" v-for='(lines,lineIndex) in book.pageList[index].text'>
<span>{{page.text[lineIndex]}}</span>
</div>
</div>
<!-- Kid's page -->
<div class="page kid-page" v-else>
<div class="video">VIDEO HERE</div>
<div class="img-container" :style="{ backgroundImage: 'url(' + page.image + ')' }">
</div>
</div>
<!-- controllers -->
<div class="controllers" v-if=isReader>
<button class="next" v-on:click='changePage("next")'>הבא</button>
<button class="prev" v-on:click='changePage("prev")'>קודם</button>
</div>
</div>
</div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="js/main.js"></script>
</html>
DTal, A couple of things to consider here. I noticed that you're using selectedPage for both the page number and the page ID. It may be simpler to map both of these to two separate variables.
The other thing to consider is that you may also want to bind what book is selected as well. Vuejs won't update the internals because it's already done the v-for loop. If you bind one of the divs (using v-bind:) to a book, and keeping track of which book is selected in the data() area then it may have the behavior you want.
There were a lot of things to be fixed in the template to make your code run but the main thing missing which was not making it run was that (copying directly from Vue documentation)
Vue cannot detect the following changes to an array:
1. When you directly set an item with the index, e.g. vm.items[indexOfItem] = newValue
2. When you modify the length of the array, e.g. vm.items.length = newLength
Change detection runs only for property mutations
Which can be achieved using
vm.$set(vm.items, indexOfItem, newValue)
which in your case would be
if (event === "next") {
this.$set(this.selectedPage, 1, this.selectedPage[1] + 1);
} else {
this.$set(this.selectedPage, 1, this.selectedPage[1] - 1);
}
I definitely feel that you can maintain the page numbers in a more efficient way(but that is a different concern)

Rails 5 JavaScript pipeline not working

I'm trying to apply a jQuery etalage in my Rails 5 app.
I copied all the assets file to 'app/assets' folder. I removed the CSS and JavaScripts links from html header file and my 'css' working just fine but JavaScripts not working. JavaScripts only works if I add the link in the body section of my 'html.erb' file.
My 'html.erb' file is below: `
<!DOCTYPE html>
<html>
<head>
<title>Pedal House | Single :: w3layouts</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!--webfont-->
<link href='http://fonts.googleapis.com/css?family=Roboto:500,900,100,300,700,400' rel='stylesheet' type='text/css'>
<!--webfont-->
<!-- dropdown -->
<!--js-->
</head>
<body>
<!--banner-->
<script>
$(function () {
$("#slider").responsiveSlides({
auto: false,
nav: true,
speed: 500,
namespace: "callbacks",
pager: true,
});
});
</script>
<div class="banner-bg banner-sec">
<div class="container">
<div class="header">
<div class="logo">
<img src="assets/logo.png" alt=""/>
</div>
<div class="top-nav">
<label class="mobile_menu" for="mobile_menu">
<span>Menu</span>
</label>
<input id="mobile_menu" type="checkbox">
<ul class="nav">
<li class="dropdown1"><a>BIKES</a>
<ul class="dropdown2">
<li>NEW BIKES</li>
<li>VELOCE</li>
<li>TREK</li>
<li>PHOENIX</li>
<li>GIANT</li>
<li>GHOST</li>
<li>BINACHI</li>
<li>CORE</li>
<li>MUSTANG</li>
<li>OTHERS</li>
</ul>
</li>
<li class="dropdown1">KIDS ITEM
</li>
<li class="dropdown1">PARTS
</li>
<li class="dropdown1">ACCESSORIES
</li>
<li class="dropdown1">ABOUT US
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<!--/banner-->
<div class="product">
<div class="container">
<div class="ctnt-bar cntnt">
<div class="content-bar">
<div class="single-page">
<!--Include the Etalage files-->
<script src="assets/jquery.etalage.min.js"></script>
<script>
jQuery(document).ready(function($){
$('#etalage').etalage({
thumb_image_width: 400,
thumb_image_height: 400,
source_image_width: 800,
source_image_height: 1000,
show_hint: true,
click_callback: function(image_anchor, instance_id){
alert('Callback example:\nYou clicked on an image with the anchor: "'+image_anchor+'"\n(in Etalage instance: "'+instance_id+'")');
}
});
});
</script>
<!--//details-product-slider-->
<div class="details-left-slider">
<div class="grid images_3_of_2">
<ul id="etalage">
<li>
<a href="optionallink.html">
<img class="etalage_thumb_image" src="assets/m1.jpg" class="img-responsive" />
<img class="etalage_source_image" src="assets/m1.jpg" class="img-responsive" title="" />
</a>
</li>
</ul>
</div>
</div>
<div class="details-left-info">
<h3>SCOTT SPARK</h3>
<h4></h4>
<p><label>$</label> 300 </p>
<h5>Description ::</h5>
<p class="desc">The first mechanically-propelled, two-wheeled vehicle may have been built by Kirkpatrick MacMillan, a Scottish blacksmith, in 1839, although the claim is often disputed. He is also associated with the first recorded instance of a cycling traffic offense, when a Glasgow newspaper in 1842 reported an accident in which an anonymous "gentleman from Dumfries-shire... bestride a velocipede... of ingenious design" knocked over a little girl in Glasgow and was fined five
The word bicycle first appeared in English print in The Daily News in 1868, to describe "Bysicles and trysicles" on the "Champs Elysées and Bois de Boulogne.</p>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<!---->
<div class="footer">
<div class="container wrap">
<div class="logo2">
<p class="copyright">2017 | Developed By Hussain & Zaman</p>
</div>
<div class="ftr-menu">
<ul>
<li>BIKES</li>
<li>KIDS ITEM</li>
<li>PARTS</li>
<li>ACCESSORIES</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</div>
<!---->
</body>
</html>
My 'application.js' file:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//= require jquery
//= require jquery_ujs
//= require jquery.easydropdown
//= require jquery.etalage.min
//= require jquery.min
//= require responsiveslides.min
//= require rails-ujs
//= require turbolinks
//= require_tree .
`
I'm new with rails and I spent a lot of time to fix this problem. I tried so many ways but none worked. Some expert user please help me to fix this issue. Thanks in advance.
Have you added gem 'jquery-rails', '~> 4.3', '>= 4.3.1' to your Gemfile? In Rails 5 jquery does not come by default.

Bootstrap 3 Datepicker + Moment.js , can't seem to get format to work

I'm trying to get the following Bootstrap 3 plugin to work:
http://eonasdan.github.io/bootstrap-datetimepicker/Options/
One of the requirement is Moment.js:
http://momentjs.com/docs/#/customization/
My HTML is:
<div class="container">
<div class='col-md-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker6'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class='col-md-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker7'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
The JS:
<script type="text/javascript" src="/clip-art/static/datepicker/moment.js"></script>
<script type="text/javascript" src="/clip-art/static/datepicker/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="/clip-art/static/datepicker/css/bootstrap.min.css" />
<link rel="stylesheet" href="/clip-art/static/datepicker/css/bootstrap-datetimepicker.min.css" />
$(function () {
$('#datetimepicker6').datetimepicker( {
maxDate: moment(),
allowInputToggle: true,
enabledHours : false,
//format: moment().format('YYYY-MM-DD'),
format: moment().format('LLLL'),
locale: "en"
});
$('#datetimepicker7').datetimepicker({
useCurrent: false, //Important! See issue #1075
allowInputToggle: true,
enabledHours : false
});
$("#datetimepicker6").on("dp.change", function (e) {
$('#datetimepicker7').data("DateTimePicker").minDate(e.date);
});
$("#datetimepicker7").on("dp.change", function (e) {
$('#datetimepicker6').data("DateTimePicker").maxDate(e.date);
});
});
</script>
I'm a bit confused, as I can't seem to get the format to work. If I use this to set the format:
format: moment().format('LLLL'),
I get a REALLY weird date! (not even sure what language that is??)
If I change it to:
format: moment().format('YYYY-MM-DD'),
The date DOES show correctly, but then the dropdown stops working for me!
Can anyone suggest where I'm going wrong? I've done loads of playing around, googling etc, but I still can't figure it out :(
BTW: The dropdown itself works when I don't try and edit the format of the date:
Ok, well I'm not sure why it didn't like taking a moment().format() value, but after checking the GitHub issues, I came across an issue with the format. It led me to this example:
https://jsfiddle.net/dugujianxiao/ad64awL7/11/
So after tweaking my code to use format: 'YYYY-MM-DD' instead, and this seems to have sorted it:
$('#datetimepicker6').datetimepicker( {
maxDate: moment(),
allowInputToggle: true,
enabledHours : false,
locale: moment().local('en'),
format: 'YYYY-MM-DD'
});
The date is correct, as well as the format.
Hopefully this helps someone else!

HtmlAgilityPack clean inner text from html

I have this html. I'm trying to get its InnerText without any tags in it,
<h1>my h1 content</h1>
<div class="thisclass">
<p> some text</p>
<p> some text</p>
<div style="some_style">
some text
<script type="text/javascript">
<!-- some script -->
</script>
<script type='text/javascript' src='some_script.js'></script>
</div>
<p> some text<em>some text</em>some text.<em> <br /><br /></em><strong><em>some text</em></strong></p>
<p> </p>
</div>
What am trying to do is get the text as the user would see it from the class thisclass.
I want to strip any script tag, and all tags, and just get plain text.
This is what am using:
Dim Tags As HtmlNodeCollection = root.SelectNodes("//div[#class='thisclass'] | //h1")
Does anyone have any ideas?
Thanks.
Try this (warning c# code ahead):
foreach(var script in root.SelectNodes("//script"))
{
script.ParentNode.RemoveChild(script);
}
Console.WriteLine(root.InnerText);
This gave me the following output:
my h1 content some text some textsome text some textsome textsome text. some text
Hope this helps.