Nopcommerce pricing tier grouped product not showing links to simple products - nopcommerce

When showing grouped products in NopCommerce. It doesn't show links to each grouped product. The simple product configuration shows this but the tiered pricing does not work.

I used javascript to get all the grouped products and added the html back in.
$('.variant-name').each(function () {
var str = $(this).html().trim();
str = str.replace(/\s+/g, '-').toLowerCase();
$(this).attr('id', str);
$('.product-name').append('<div>' + $(this).html().trim() + '</div>');
});

Related

Installment widget - Wordpress + Woocommerce

What's the problem?
I want to add a PayU plugin installment widget for a product subpage for WooCommerce, but I have a problem with displaying the product price in the calculator provided in the documentation.
Code source for implementing such a calculator:
https://developers.payu.com/en/installments.html#installments_best_practices_mini
<p><span id="installment-mini"></span></p>
<script type="text/javascript">
var value = 1234.56;
if (value >= 300 && value <= 50000) {
var options = {
creditAmount: value,    // amount in PLN
posId: '67328',         // point of sale identifier
key: 'zQ',              // first two characters of API key
showLongDescription: true
};
  OpenPayU.Installments.miniInstallment('#installment-mini', options)
.then(function(result) {
// This fragment of code will be executed after widget is shown
// parameter ‘result’ contains additional functions
})
.catch(function(e) {
console.error(e.toString()); // This snippet writes config errors
// to developer’s console
});
}
What do i want to get?
I want only the product price in the product card to be downloaded to the installment calculator. There is no input field in the product card, only , I thought about a positive in the php code but it did not work. I want to add a regular price or the price of a product variant to the JS code to show the customer what he can do when choosing installments, so the price must be taken to the code above.

Stuck with adding GA standard ecommerce transaction throught GTM

We use GTM to add GA to our website. Standard eCommerce tracking is enabled in GA. To start this project I am testing in our DEV environment which uses the same GTM/GA accounts. Only data from the live site shows up in GA so DEV is filtered out (I'm not sure how this is done yet). I have two problems.
How do I set up the 'transactionProducts' to loop through the items in the cart and display them separately instead of all smooshed together?
What do I do to see results in GA from the DEV site - I can't test this live - unless I create a noindex/nofollow static page on the live site with fake data to see if it will send it to GA.
I created the GTM eCommerce tag per GA directions:
Tag Type: Google Analytics: Universal Analytics
Track Type: Transaction
Google Analytics Settings: Enable overriding settings in this tag (we have a GA variable but I've decided to not use it incase it might interfere)
Tracking ID: UA-########-#
I created the GTM eCommerce trigger per GA directions:
Trigger Type: Page View (the DataLayer comes way after the GTM script)
This trigger fires on: Some Page Views
Fire this trigger...: Page URL contains /order/confirmation
The confirmation page is it's own page that comes after submit order page.
The DataLayer is thus:
<script>
if(window.location.pathname == "/order/confirmorder"){
// capture values from the spans with the following classes
var GAtransactionId = jQuery(".lblOrderNumber").text();
var GAtransactionTotal = jQuery(".lblTotal").text();
var GAtransactionTax = jQuery(".lblTax").text();
var GAtransactionShipping = jQuery(".lblShippingHandling").text();
// transactionProducts data from the spans with the following classes
var GAsku = jQuery(".lblProductSKU").text();
var GAname = jQuery(".lblProductSKU").text();
var GAprice = jQuery(".lblYourPrice").text();
var GAquantity = jQuery(".lblOrderItemQty").text();
// Checking my variables before they go thru
alert("GAtransactionId: " + GAtransactionId + " GAtransactionTotal: " + GAtransactionTotal + " GAtransactionTax: " + GAtransactionTax + " GAtransactionShipping: " + GAtransactionShipping + " GAsku: " + GAsku + " GAname: " + GAname + " GAprice: " + GAprice + " GAquantity: " + GAquantity);
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'transactionId': GAtransactionId,
'transactionTotal': GAtransactionTotal,
'transactionTax': GAtransactionTax,
'transactionShipping': GAtransactionShipping,
'transactionProducts': [{
'sku': GAsku, // returns each item - but smooshed together
'name': GAname, // returns each item - but smooshed together
'price': GAprice, // returns each item - but smooshed together
'quantity': GAquantity // returns each item - but smooshed together
}]
});
}
</script>
In GTM Preview mode I do see the Current values of the Data Layer: but if I have more than one item in my cart the 'transactionProducts' items get all smooshed together.
transactionProducts: [
{
sku: 'ABCDEFGHIJK''
name: 'Blue CoatRed Coat',
price: '$30.99$31.99',
quantity: '11'
}
]
How do I loop through 'transactionProducts' to show each item in the cart separately? I guess a for loop might do but how would I set it up and then where would I add it to the DataLayer so it doesn't break anything? Also, do I need to remove the '$' sign from the result (I know how to do that)?
And where might I find a filter that prevents data from the DEV site from being sent through - so I can temporarily disable it while I test? And do I need to publish the GTM tag/trigger to have it actually send data or can I use Preview mode and expect to see DataLayer data in GA Conversions > Ecommerce > Overview?
you have to construct your items object looping through product elements in your cart instead of getting combined text value of all spans:
some sample code might look like:
var items = []
$('.some-product-selector').each(function () {
items.push({
'sku': $(this).find('.lblProductSKU').text(),
'price': $(this).find('.lblYourPrice').text()
// the same pattern for other fields
})
})
// ...
dataLayer.push({
'transactionId': GAtransactionId,
'transactionTotal': GAtransactionTotal,
'transactionTax': GAtransactionTax,
'transactionShipping': GAtransactionShipping,
'transactionProducts': items // use your items here
});

How to get the variable product variation price on change

I want to get the variation price on my single product page, On change the variation drop-down using jQuery, Is there any way to doing this... ?
Thanks in advance.
woocoommerce has build in callback result product details (attributes, price, images, etc..)
you can see variation details on console
jQuery(document).ready(function() {
jQuery( '.variations_form' ).each( function() {
// when variation is found, do something
jQuery(this).on( 'found_variation', function( event, variation ) {
console.log(variation);
console.log(variation.display_price);//selectedprice
});
});
});

Redirect user to a page after payment in shopify

I am using shopify,
I send user to shopify with certain product number and quantity, which is being populated with price on shopify where user can make a payment,
Now i want the user to be redirected to a certian page in my website, after successful payment,
I created webhook order payemnt and given the url of the page to be redirected after payment, but it is not working
Please suggest
Thanks
You could set up a redirect by visiting Settings > Checkout and pasting this into the text box for Additional content & scripts.
<style type="text/css">body {display:none}</style>
<script type="text/javascript">
window.location.replace("http://yahoo.com");
</script>
If you are looking to redirect a customer to a different URL depending on the product they purchased, then here is some code I created to do that.
NOTE: This code is inserted into the Additional Scripts section of the Checkout area. To go there go to Settings > Checkout > scroll down to Additional Scripts.
This solutions uses the Shopify checkout object selector #Altin provided.
Keep in mind, this solution works uniquely for my Shopify experience because customers can only buy 1 product at a time. If your customers can add multiple items to their carts, than a for loop should be used, likely around the for in loop.
<script>
const idUrlList = {
// Replace the content below here with your own
"product1": {
"url": "https://www.URL-HERE.com",
"product_id": 1234567898765,
},
"product2": {
"url": "https://www.URL-HERE.com",
"product_id": 1234567898765,
},
"product3": {
"url": "https://www.URL-HERE.com",
"product_id": 1234567898765,
},
"product4": {
"url": "https://www.URL-HERE.com",
"product_id": 1234567898765,
},
// Replace the content above here with your own
};
// Do NOT change anything below this line
const productPurchasedId = Shopify.checkout.line_items[0].product_id;
for (const product in idUrlList) {
if (idUrlList[product].product_id === productPurchasedId) {
window.location.replace(`${idUrlList[product].url}`);
}
else {
console.log(`Found no matches in dictionary.
The dictionary ID is ${idUrlList[product].product_id}
The product ID is ${productPurchasedId}`);
};
};
</script>
To make this work for you, make the following replacements:
Replace "product1" with the name of the product or redirect that you will find memorable. For example, in one of mine I wrote "20_off_2020".
Replace https://www.URL-HERE.com with the link you want people to go to. For example, https://theamsalems.com/
Replace 1234567898765 with the unique product ID that you want to check for. This can be found in Shopify. Go to Products, click on a product, and grabbing the string of numbers at the end of the URL.
Add/remove the other products depending on how many products you have. For example, if you only have two products, remove the code from "product3" all the way up to the line which says // Replace the content above here with your own.
The rest of this code will automatically handle finding product IDs and handling their correct redirects.
Here are some of my references to building this solution:
Shopify checkout object, line_items array
Line items product ID
I also found out you can test your pages using a Bogus Gateway. Shopify documentation available here.

How to add an existing contact to multiple groups in google contacts using "Google Data API (GData)"

My platform is Asp.net. I am new in Google Data API (GData). I am using this code to add a new contact to an existing group.
public Contact AddContactToGoolgeGroup(GoogleContactsGroup group, Contact googleContact)
{
googleContact.GroupMembership.Add(new GroupMembership { HRef = group.GoogleContactGroupId });
var feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));
return _contactsRequest.Insert(feedUri, googleContact);
}
this code work's fine to add a new contact.
But i want to add an existing contact to multiple groups or a single group. How i do that. I used this code but not working.
googleContact.GroupMembership.Add(new GroupMembership { HRef = group.GoogleContactGroupId });
_contactsRequest.Update(googleContact);
Thanks.

Resources