Jump to content

Getting specific customer price in "external" php file


Recommended Posts

Hi There, i have a small feature function which i need "externally" from the shop, where i need to get the specific price, for a specific customer on a product...

i have created the following php file, which can access the prestashop config files...

 

include 'config/settings.inc.php';
include 'config/config.inc.php';
 


$id_lang=(int)Context::getContext()->language->id;
$start=0;
$limit=100;
$order_by='id_product';
 $order_way='DESC';
$id_category = false; 
$only_active =true;

$all_products=Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category,$only_active,$context);
print_r($all_products);

//WORKS


$id_product = (int)275;
$id_customer = (int)$context->customer->id;
$id_cart = (int)$context->customer->id_cart;
$product = new Product($id_product, false, 2);


$price = Product::getSpecificPrice($id_product,$context->customer->id_shop,$context->customer->id_currency,$context->customer->id_shop,20,$context->customer->id_default_group,1,NULL,$context->customer->id,$context->cart,0);

var_dump($price);
 

but the "Product::getSpecificPrice" doesnt work...?

 

please note that i am not trying to create a module or anything integrated in the shop itself...

prestashop 1.6.1.6


EDIT i got it to work... the correct code for the specific price was this:

 

$price = SpecificPrice::getSpecificPrice($id_product,$context->customer->id_shop,$context->customer->id_currency,20,$context->customer->id_default_group,1);

Edited by diondp
found the solution. (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...