update a spree product's price from rails console - spree

somewhat related to 1
How update a spree product's price from rails console?
what I tried:
irb(main):011:0> pp Spree::Product.last.display_amount.to_s
=> "$13.99"
irb(main):012:0>

Spree::Product.last.update(price: '1')

Related

OPENCART search by model in featured module

in opencart when edit my featured module, and add new product, my search is by name, and not by model...
it is possible search by product model?? and not by name
this happens in all modules that need to add a product
You don't need to do much more just edit below file only:
\opt\lampp\htdocs\opencart\admin\view\template\module\featured.tpl
on Line no.121
url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_name=' + encodeURIComponent(request.term),
You need to just
url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_model=' + encodeURIComponent(request.term),
you need to filter_model as parameter which you will be type

Rails 4 and Active Admin: ActiveModel::ForbiddenAttributesError

The full error is the following:
ActiveModel::ForbiddenAttributesError in Admin::ProductsController#create
My product model only has a name and price. Why is commit a parameter? When I click the 'Create Product' button within the admin dashboard, this is the params output:
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"6/pCeklsaik4sYF5h8+WRPddkH7wJn9ZJHd6YLaaNuc=",
"product"=>{"name"=>"Black Shirt Male",
"price"=>"25"},
"commit"=>"Create Product"}
From what I've gathered reading other Stack Overflow posts, you need to use strong parameters in Rails 4 instead of attr_accessible, which was done for me when I scaffolded the product model. In my create action in the Products controller, I have:
#product = Product.new(product_params)
And product_params is defined as:
def product_params
params.require(:product).permit(:name, :price)
end
I didn't do anything fancy when I created the model, and in my Gemfile I'm using the following as the documentation suggested for Rails 4:
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
Why am I getting this error when I create a new product via the Active Admin dashboard? Any input on the matter is appreciated.
Alright figured it out. I'm not sure if this is the 'correct' way but the products are being created.
in app/admin/product.rb I did:
permit_params :list, :of, :attributes, :on, :model, :name, :price
where
permit_params :list, :of, :attributes, :on, :model
was initially commented out. So I just added :name and :price
Question already answered, but I'm adding this as a helpful resource to supplement this answer:
https://github.com/activeadmin/active_admin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters

Shopify Python API - how to search for a product

I have built a django app that is the primary store for my products. From this, I publish products to my Shopify Store. Now my django app knows first when my product goes out of stock.
Question:
What options do I have to search for products using the Python API? Can I search by Title, Variant SKU?
Is storing the generated ID while publish the only means to get a handle on the product later?
I want to do this - so that I can mark the products Out Of stock, in a batch process, for example.
Storing the product's id is the simplest way to get a handle on the product later.
However, the product API shows that you can filter products by vendor, handle, product_type, collection_id, published_status, updated_at, created_at or published_at.
The Using the shopify python API page shows how you can use these filters through keyword arguments to the find class method, e.g. shopify.Product.find(collection_id=841564295) to list products in a specific collection.
YOu can use the official shopify python API to find a product with id:
shopify.Product.exists(product.id) # => True
product = shopify.Product.find(292082188312)
For searching products with the product title, you can use GraphQL API

opencart affiliate tracking not working

I want to track visitors coming from affiliate websites to my shopping cart. I see they have affiliate tracking, but I cant seem to find documentation. i tried adding ?tracking=idhere to URLs but its not working. I have added an affiliate and set the commission rate but still nothing.
Update: Using Version 1.5.2.1. I basically need a howto on affiliate tracking. I've never used it or opencart for very long. I can see any decent documentation. Is affiliate tracking built in or do I need a 3rd party extension for what I want.
Update 2: I dumped the $_SESSION variable on the cart page, and the tracking code isn't there.
Array
(
[language] => en
[currency] => USD
[cart] => Array
(
[51] => 1
)
[captcha] => 93e639
[vouchers] => Array
(
)
)
Tracking isn't done through sessions, it's done through a cookie. You can see the cookie code in the index.php file
if (isset($request->get['tracking']) && !isset($request->cookie['tracking'])) {
setcookie('tracking', $request->get['tracking'], time() + 3600 * 24 * 1000, '/');
}
This is then captured during the checkout process, which you can see in
/catalog/controller/checkout/confirm.php
If this isn't working, then you are either not putting the correct id for an affiliate, or cookies aren't being saved/read correctly for some reason

Issue with postfinance module in oscommerce

I have integrated postfinance module for oscommerce. I have done everything mentioned in http://addons.oscommerce.com/info/6442 docs.When I tried to test it in 'test mode' ...after selecting the payment method it is redirecting to 'Order success' page with out showing option to enter postfinance card details....in the admin panel it shows that a purchase has been made and it is processing.
At your checkout_confirmation.php please replace:
if ($$payment->code == 'paypal_ipn') {
with
if (isset($$payment->form_action_url)) {