Shopping cart doesn't update (unless I refresh page) - prestashop

When I click 'Add to Cart' for a product, the cart doesn't update (unless you refresh the page). I've set the freeshippingtranslation to zero (see code below) but still not updating.
Can anyone help with this issue please? I use Prestashop 1.5.5 and my site is www.ayereadytshirts.com
if (parseFloat(jsonData.shippingCostFloat) > 0 || jsonData.nbTotalProducts < 1) $('.ajax_cart_shipping_cost').text(jsonData.shippingCost);
else if (typeof(freeShippingTranslation) != '0')
$('.ajax_cart_shipping_cost').html(freeShippingTranslation);

freeShippingTranslation is not defined
In comparsion you should use instead of
else if (typeof(freeShippingTranslation) != '0')
such a way
else if (typeof freeShippingTranslation === undefined)

Related

Razor-Pages - HTML markup

Following the answer on this post I was using #:<div class="col-md-6">
Problems
The Formatting gets all messed up:
The intellicode gets all messed up (I only deleted the paragraph on the second #:)
Also, my if (i == (Model.CellsNotStarted.Count - 1) && i % 2 != 0) won't work when using the #:; it will always go on the else. If I don't use the #: markup, and if I, for instance put all my html in a if/else instead of only the <div> tag it will work with no problems.
My question is:
Is the #: markup viable? If so, what am I doing wrong. If not what is the alternative (that does not imply putting my entire code in an if/else)
PS: I know I should not post images of code, but I wanted to show the format and syntax errors.
There are neater ways to manage conditions within your Razor code. It's difficult to provide a full example because you don't provide the full code, but you can do this, for example:
<div class="col-md-#(i+1 == Model.CellsNotStarted.Count && i % 2 ! = 0 ? "12" : "6")">
Whenever you are tempted to use a remainder operator (%) in Razor, you should also consider whether a GroupBy would be better. It most often is, as I was shown in this question: Building tables with WebMatrix
You can try to use js to set html.Here is a demo:
<div id="myDiv"></div>
<script>
$(function () {
var html = "";
if ("#(Model.CellsNotStarted != null)"=="True")
{
for (var i = 0; i <#Model.CellsNotStarted.Count; i++)
{
if (i == (#Model.CellsNotStarted.Count - 1) && i % 2 != 0)
{
html += '<div class="col-md-12">';
}
else
{
html += '<div class="col-md-6">';
}
html += i+'</div>';
}
}
$("#myDiv").html(html);
})
</script>
result:

Showing negative values on progress bar in qt

I have 8 different progress bar. In the code below, im showing the positive values of my array. I want to display negative values also. How can i do it?
When i put else and write the other progress bar on gui, it didnt work true
if(dizi[1] > 0 || dizi[2] > 0 || dizi[3] > 0 || dizi[4] > 0)
{
ui->progressBarAx->setValue(dizi[1]);
ui->progressBarAy->setValue(dizi[2]);
ui->progressBarBx->setValue(dizi[3]);
ui->progressBarBy->setValue(dizi[4]);
}
You could use the method setFormat(const QString &format) to generate the text you need.
Example:
ui->progressBar->setValue(5);
ui->progressBar->setInvertedAppearance(true);
ui->progressBar->setFormat(QString("-") + QString("%p"));
ui->progressBar_2->setValue(51);
ui->progressBar_2->setInvertedAppearance(true);
ui->progressBar_3->setValue(5);
ui->progressBar_3->setFormat(QString("-") + QString("%p%")); //with %
ui->progressBar_3->setInvertedAppearance(false);
ui->progressBar_4->setValue(51);
ui->progressBar_4->setInvertedAppearance(false);
The method setInvertedAppearance is also interesting to show the progress inverted.

best way to change download link based on an input field?

I program in C (embedded programming) but have no experience for web-based stuff. I have a need to download a different link based on an input field.
input serial number in field.
click download link
if serial number = a,b,c etc.. download file_version_a
else if serial number = e,f,g, etc.. download file_version_b
what is the best script language to use to for something like this? I've searched all over and haven't found much that seems relevant and don't know where to start.
You could use something like below in your html page :
<input type="text" id="serialnumbers" name="serialnumbers"></input>
<input type="button" id="download" name="download" onclick="downloadlink();return false;"value="Download Now"></input>
<script>
function downloadlink(){
var serialnos=document.getElementById('serialnumbers').value;
serialnos = serialnos.trim();
if( serialnos == "a" || serialnos == "b" || serialnos == "c" )
window.location = download file_version_a;
}
else if( serialnos == "e" || serialnos == "f" || serialnos == "g" )
window.location = download file_version_b;
}
</script>
Also,some suggestions for the same would be to check Jquery,very convenient Javascript library ,Refer Doc :https://jquery.com/

Get marked range from NSTextInputContext

I was trying to clean up deprecation warnings of a certain project and the snippet of code looked like:
NSInputManager* im = [NSInputManager currentInputManager];
if (im && [im markedRange].length > 0) return NO;
I got this far:
NSTextInputContext* im = [NSTextInputContext currentInputContext];
if (im && [im /* What goes here? */].length > 0) return NO;
I am trying to get the marked range of the NSTextInputContext. How would I go about doing that?
This should work:
NSTextInputContext* context = [NSTextInputContext currentInputContext];
id<NSTextInputClient> client = context.client;
if (client && client.markedRange.length > 0) return NO;
The client is usually the text view with the focus, so the first responder of the key window. So, you can maybe bypass looking it up this way and just go straight to the text view.

Adobe 9 Check box required field

I've created reports in Adboe that have checkobxes and set then to required fields.
But when i click the submit button all fields but the check boxes are validated.
I.e
If i dont complete the required textbox field the report will not submit, but when i do and the required checkbox fields are not checked it still submits.
This only appears to be happening on Adobe 9
Any ideas?
Thanks
Sp
Here is a link to a test page
http://www.mediafire.com/?mnkmmlime2f
If you fill the text box with anything it will submit regardless of the check box status (which is also a required field)
I have figured it out.
Adobe Reader checkbox allows has a value (default "false") so when the form validates it sees the checkbox as having a value.
I've had to write some java to stop the form submitting if the checkbox has a null/False/false value
This works like a dream
Thanks for trying to help wit hthis post all
var f;
var Valid = "1";
for (var i = 0; i < this.numFields; i++)
{
f = this.getField(this.getNthFieldName(i));
if (f.type == 'checkbox')
{
if(f.required == true)
{
if(f.value == "false" || f.value == "False" || f.value == "null")
{
Valid = "0";
}
}
}
};
if(Valid == "1")
{
this.submitForm('');
}
else
{
app.alert("Please complete all required fields");
}