How change BO product list to also show wholesale price Prestashop 1.6 - prestashop-1.6

Someone who has made this change?
Today the BO product list show the end customer price excl and incl vat.
I want if possible to show our wholesale price and mour end customer price excl vat instead. This is probably a change in AdminProductController but I dont know how. I run PS 1.6.1.6
Regards
Anders Yuran

Open /controllers/admin/AdminProductsController.php from your PrestaShop root directory and in the __construct() function, you will see the following code:
$this->fields_list['price'] = array(
'title' => $this->l('Base price'),
'type' => 'price',
'align' => 'text-right',
'filter_key' => 'a!price'
);
This code is responsible for showing the price in products list, try replacing the code with the following:
$this->fields_list['price'] = array(
'title' => $this->l('WholeSale price'),
'type' => 'price',
'align' => 'text-right',
'filter_key' => 'a!wholesale_price'
);
Hope it helps.

Related

Setting business name and header images with adaptive payments on paypal

In order to ensure consistent experience i want to set header image and business on paypal's page, view items with their names and description and ask the customer to select shipping address.
I'm using active_paypal_adaptive_payment gem (https://github.com/jpablobr/active_paypal_adaptive_payment) and the option to set_payment_options:
response = ADAPTIVE_GATEWAY.setup_purchase(
:action_type => 'CREATE',
:receiver_list => recipients,
...
)
ADAPTIVE_GATEWAY.set_payment_options(
:display_options => {
:business_name => 'Big Business',
:header_image_url => 'url goes here'
},
:sender_options => {
:require_shipping_address_selection => true },
:receiver_options => [{
:description => _description,
:invoice_data => {
:item => [{
:name => _title,
:item_count => 1,
}],
:total_shipping => 10.0,
:total_tax => 10
},
:receiver => {
:email => email
}
}])
)
The issue is that it doesn't work - i do not see any business names or image, i see generic names on the left column (the one with the items and the flow doesn't ask for shipping address).
Could you please advise?
You can also do so by logging into PayPal, then going to My Selling Tools and update the Custom payment pages option to create a new page style with the color combination and logo of your choice (there are size restrictions for the logo images)

Displaying choice based on foreign key / join

I have folowing schema:
Template
UserTemplate
template_id
Costs
template_id
amount
value
What I'm trying to do, is to create a sfWidgetFormDoctrineChoice that displays the shipping costs based on a UserTemplate id.
$this->widgetSchema['cost'] = new sfWidgetFormDoctrineChoice(array(
'model' => 'Costs',
'key_method' => 'getValue',
'method' => 'getAmount',
'add_empty' => 'Please Select Amount',
'expanded' => false,
'multiple' => false
));
This displays all of the Costs.
Ideally, I'd like it to limit it to the UserTemplate.
I have looked at creating a custom query and passing that into the widget, but I'm not sure if this would be the correct way of doing this
So If I have a bunch of costs assigned to the template id of 12 and the user template references 12, when I'm on example.com/user-template/12 - I'd expect to see the costs for this in my form widget.
Creating a custom query and passing it to the widget is exaclty what you're looking for. You will have to build the query depending on the template_id you use in the URL.

How do you use the Gibbon Gem to automatically add subscribers to specific interest groups in MailChimp?

I'm trying to figure out how I can use the Gibbon gem in Rails to automatically add subscribers to specific interest groups in MailChimp?
I've found this article which details a non-Rails method for doing so: http://roman.tao.at/uncategorized/mailchimp-api-listsubscribe-listbatchsubscribe-and-groups/
I'd like to figure out how to implement that functionality using the Gibbon gem: https://github.com/amro/gibbon
FYI, I'm also a novice with both MailChimp and Rails.
Finally, after hours of perusing through code. I've found the example I'm looking for!
Thanks to TJ Moretto for providing this on a Google Groups thread:
I'm using the gibbon gem, but ran into the same types of issues.
Here's how I had to format the parameters to finally get this to work:
gb.list_subscribe({:id => "#{list.id}",
:email_address => user.email,
:update_existing => true,
:double_optin => false,
:send_welcome => false,
:merge_vars => {'FNAME' => "#{user.first_name}",
'LNAME' => "#{user.last_name}",
'GROUPINGS' => {0 => {'id' => grouping.id, 'groups' => "#{challenge.name}"}}}
})
Hope that helps.
Mailchimp Team - based on the number of issues that everyone runs into
when trying to do this (across all programming languages), I suggest
you update the API documentation to be more clear.
Update for version 2.0 of the MailChimp API and version 1.0 of Gibbon (For #Calin and posterity). Here are the necessary changes from the previous version. The API object is accessed like this now:
gb = Gibbon::API.new
And list methods like so:
gb.lists.subscribe(params)
Finally the :email_address parameter has been replaced by the :email parameter, which should be given a value of the following form: The value should itself be a hash with one key, either 'email' or 'leid', and the value should be either the email address of the subscriber or MC's unique identifier (LEID) for the subscriber.
So a full subscription call might look something like this:
gb = Gibbon::API.new
gb.lists.subscribe(:id => "ed6d1dfef4",
:email =>
{ "email" => "example#domain.com" },
:merge_vars =>
{:groupings =>
{
0 => { :id => "95", :groups => ["Some Group", "Another Group"]},
1 => { :id => "34", :groups => ["A Third Group"]}
}
},
:update_existing => "true",
:double_optin => "false",
:replace_interests => "false")

PayPal express / Active Merchant - not displaying line items or cart total?

I'm trying to set up a PayPal express checkout using active merchant but I'm running into problems. I've followed a tutorial and I can get to the "choose a way to pay" form on paypal but there are no items or prices displayed.
Here's a screenshot. http://i39.tinypic.com/35mircz.png
Why is not displaying a price or any items even though I'm passing them in? Here is the code I'm using to setup_purchase.
#product = Product.find(params[:product_id])
setup_response = gateway.setup_purchase(200,
:ip => request.remote_ip,
:items => [{:name => "Tickets", :quantity => 22, :description => "Tickets for 232323", :amount => 10}],
:return_url => url_for(:action => 'confirm', :only_path => false),
:cancel_return_url => url_for(:action => 'index', :only_path => false)
)
redirect_to gateway.redirect_url_for(setup_response.token)
Any help would be greatly appreciated.
Alex
Your problem lies with your quantities and pricing - if you output setup_response after it does the call with something like
logger.debug setup_response
And check the log, you'll see that it's probably complaining that the price in the items is not matching up to the amount you're passing (the first value).
At the moment, you have a quantity of 22, with each 'amount' being 10. 10*22 = 220, and since you're only putting in 200 in the first value, you're mis-matching them. Fix that and you should be good to go.
I have encountered the same issue and have finally found the reason, and it is unbelievably stupid. Are you ready?
There is a mismatch between the total price you specified (200) and the sum of your items (22*10=220). If you change your quantity to 20, it will work. Paypal requires that the sum of your items' cost would equal the total price you specify. I have no idea how I realised this.

Ruby on Rails / Yellow Maps For Ruby Plugin woes

Okay I've read through the plugin comments and the docs as well and I have yet to come up with an answer as to how to do this. Here's my problem I want to use the :info_window_tabs and the :icon option, but I don't know what format to pass my information in. According to the documentation the following code should be correct. Here's my code:
#mapper.overlay_init(GMarker.new([map.lat, map.lng],
:title => map.name,
:info_window_tabs => [
{:tab => "HTML", :content => #marker_html},
{:tab => "Attachments", :content => "stuff"}],
:icon => {
:image => "../images/icon.png"
}))
The readme and documentation can be viewed here.
And the relevant ruby file that I am trying to interact with, including the author's comments, can be viewed here.
I have tried the #rubyonrails channel in IRC as well as emailing the author directly and reporting an issue at GitHub. It really is just a question of syntax.
Thanks!
Okay, so I finally got this figured out. Here's how you do it; :icon accepts a GIcon variable and :info_window_tabs accepts an array of GInfoWindowTabs. Here is how you would declare each with the plugin.
Declare GIcon
#mapper.icon_global_init(GIcon.new(:image => "../images/civil.png",
:icon_anchor => GPoint.new(0,0),
:shadow => "../images/shadow.png",
:shadow_size => GSize.new(37,32),
:info_window_anchor => GPoint.new(9,2)), "civil_icon")
#civil_icon = Variable.new("civil_icon")
Declare GInfoWindowTab
#tab1 = GInfoWindowTab.new('Tab 1 Label', 'HTML for inside of tab1')
#tab2 = GInfoWindowTab.new('Tab 2 Label', 'HTML for inside of tab2')
#window_tabs = [#tab1, #tab2]
Then in your GMarker declaration just do the following:
#mapper.overlay_init(GMarker.new([map.lat, map.lng],
:title => map.name,
:icon => #civil_icon,
:max_width => 300,
:info_window_tabs => #window_tabs))
And you're done.

Resources