Bigcommerce stencil bug with related_products front-matter - bigcommerce

I think there may be a bug with related products. I have added the following front-matter to my product.html page:
product:
related_products:
limit: 20
similar_by_views:
limit: 20
Regardless of the limit I set for related_products, I am never able to get more than 5 back from the server. If I set it to 1, 2, 3, 4, or 5, it works, but if I set it to anything larger than 5, I only get 5 products.
This is not true for similar_by_views. That settings works correctly. Is this a bug with related_products?

5 related products is the limit of the core app to be displayed. Stencil documentation is being revised to reflect this. It is intended behavior, not a bug.

Related

BigCommerce Stencil CLI Blog - Conditions

Is there any possible way to display blogs in BC from a certain count? For example, I want my top 3 most recent posts on the top of the blog page, but then beneath in a different format 4 onward would display. Anyway to start with the 4th blog down?
They are returned in most recent order, but you can limit the total to 7 in your example. I would then use Handlebar helpers in your Stencil theme to grab the first 3 for the top section and the next for for the last section. {{#for 1 3}}{{/for}} for the top section and {{#for 4 8}}{{/for}} for the bottom section

Issue with page_info and products.json

I'm a developer working on a private app to manage the database and the inventory of a Shopify Online Store with Symfony and I'm looking for getting all products or inventory of the store.
I tried with the url https://{{api_key}}:{{password}}#{{shopify_domain}}/admin/products.json , but it gets only 50 to 250 products and there's more than 200 000 products on this online Store. I also tried with /admin/inventory_items, but it returns missing or invalid parameter.
Recently, I checked the documentation of cursor-based pagination and I saw that there's a parameter call page_info but I didn't know how to get it. So after many researches, I learned that I had to find the parameter on the last product displayed to go to the next product which will be on the next page. I also seen that there was a parameter on GraphQL which is called storefrontId, it looked like page_info so I tried to add it to the URL but it didn't worked. I noticed that there were a = to the end of the URL, so I tried it with =0 =1 =2 and =3, also with =rel=next =next and =page=2 but it returns the same error : { "errors": { "page_info": "Invalid value." } }
For people who will find me a solution with downloading data and uploading it daily, this is not relevant because on this online store there is more than 200 000 products and the employee aren't developer.
If there is a possibility to update and display the database in real-time, without uploading a file, it would be perfect !
If you know how to help me, I'm open to suggestions !
Thanks,
Karim HADJ-ABDELKADER
The parameter page_info should be unique ID and not just number, look at this docoment about the pagination paramenters
https://shopify.dev/docs/api/usage/pagination-rest#parameters
for example :
https://{shop}.myshopify.com/admin/api/2019-07/products.json?page_info=hijgklmn&limit=3

Stacking Discount Codes in Shopify

I am trying to apply Two Discounts in Shopify cart. I read the documentation and I found out that you can do the same by Using Scripts App provided to Shopify Plus Accounts. So, I went ahead and created a Discount Script. The script executed perfectly after creation in the Shopify Console. But, when I tried to do a preview it did not seem to work as by default a discount was not applied to the cart.
Secondly, after creating the Script it provided me a ruby script. I also don't know where to place it. I mean i may be missing that part as a result of which i am not getting default discounts applied to the cart. Below is the auto-generated ruby script:
DISCOUNTS_BY_QUANTITY = {
10_000 => 20,
1_000 => 15,
100 => 10,
10 => 5,
}
Input.cart.line_items.each do |line_item|
next if line_item.variant.product.gift_card?
quantity, discount = DISCOUNTS_BY_QUANTITY.find do |quantity, _|
line_item.quantity >= quantity
end
next unless discount
message = "#{discount}% off when buying at least #{quantity}."
line_item.change_line_price(
line_item.line_price * (Decimal.new(1) - discount.to_d / 100),
message: message,
)
end
Output.cart = Input.cart
My Question is:
How can I implement stackable discounts in Shopify?
What is the use of the autogenerated code in the Scripts Editor and how to use it?
I asked this question quite a long time back and coming back again as i have a fair idea how shopify scripts work now. The script is executed everytime on checkout page and if a condition is satisfied then it will execute as per the code written. Below is an example where 10% OFF shipping has been provided to a user who has been tagged as a Platinum User.
customer = Input.cart.customer
if customer
customer.tags.each do |tag|
next unless tag == 'Platinum'
Input.shipping_rates.each do |shipping_rate|
shipping_rate.apply_discount(shipping_rate.price * 0.10, message: "Discounted shipping")
end
end
end
Output.shipping_rates = Input.shipping_rates
The Shopify Script app is a very powerful tool and can be used to provide really good customization to a Shopify Store. The documentation provided for the App also is very explanatory and should help one out if you want to code this on your own.
Documentaion Link - Link
Update:
Seems shopify scripts are now only available to Shopify Plus customers. This answer likely would not help customers who do not have Shopify Plus.

Does there exists an automated tool to combine PDF pages?

I have recently scanned lecture notes containing pages 1, 2, ..., 100. Since the scanner only operates on one side of the page, I did it in two rounds.
The first round gave me a PDF document containing pages 1, 3, ..., 99 in this order.
In the second round I turned the notes around and the scanning procedure gave me pages 100, 98, ..., 2 in this (reversed) order.
I would like to automatically merge two files so that the resulting file contains pages 1, 2, ... 100 in the normal order. More generally, I am looking for a Combine function operating on PDF documents, such that
Combine([1, 3, ..., 2n-1], [2n, 2n-2, ..., 2]) = [1, 2, ..., 2n]
What would be an easy way to do this without writing too much code? The language, library and other implementation details do not matter for me.
All I care is to find an automatic way for swapping 100 pages, so that I would not need to do that manually. However, writing 1000 lines of code would be an overkill for such task. Hence, I am searching for a good compromise. Any advice?

Aspose PdfFileEditor Cutting off Pages

I have a function that takes non specified number of PDFs (in a List) and turns them into 1 PDF using the PdfFileEditor.append function, like so.
pdfFileEditor.append(streams.get(x), streams.get(y), 1, 1500, outputStream);
The function that controls the merging is usually fine. Except there is 1 PDF in the application that seems to always eat anything that was appended before it.
For example, if we have 5 PDFs where number 3 is the bad one.
We can either use a forward loop (append 1 and 2, then 1&2 and 3, then 1&2&3 and 4, then 1&2&3&4 and 5) or a backwards loop (append 4 and 5, then 3 and 4&5, then 2 and 3&4&5, then 1 and 2&3&4&5) to combine the PDFs.
In a forward loop, we end up with only 3, 4, and 5 in the final PDF. In a backward loop, we end up with 1, 2, and 3 in the final PDF.
I am not sure what's wrong with PDF 3. It opens fine. But it does appear to be a dynamic PDF (has fields etc). I tried both forward and backwards loops because I thought maybe the PDF type was causing a reset to occur on the output stream somehow.
Has anyone seen the append method essentially just ignore a stream before?
Notes
I know this is a deprecated package from Aspose. But company standards means we cannot update to the new package.
Code is helpful - I can include the method, but it is long and the issue is clearly with the 1 PDF. Everything works in all cases except when a certain PDF is included in the list.
I am social media developer at Aspose. I would suggest you to download and try the latest version of Aspose.Pdf at your end to see if the problematic file works fine with the latest version. Also, it would be better if you save your complete code, version of library you are using and the problematic file with us.