News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Get cart session and change price

Started by baoquocmt159, March 27, 2015, 09:34:40 AM

Previous topic - Next topic

baoquocmt159

Hi all,

I have develop an system plugin, and on the cart page, i have options, how to i can get cart session and change the Total price when i choose options.

Thank so much !

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

baoquocmt159

Quote from: Milbo on March 27, 2015, 09:53:45 AM
check the textinputplugin.

Hi Milbo,

I did checked but that's vmcustom plugin so i can't get anything.
Also i have tried with code :



if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();
if(!class_exists('VirtueMartCart')) require(JPATH_VM_SITE.DS.'helpers'.DS.'cart.php');
$cart = VirtueMartCart::getCart();

$cart->cartPrices['billTotal'] = $cart->cartPrices['billTotal']+10;


But it's still nothing change.

I think i did wrong. Do you have solution?

Thank you so much !

PRO

are you using system plugin?

or virtuemart custom plugin?

what version are you using?


baoquocmt159

Quote from: PRO on March 27, 2015, 14:46:52 PM
are you using system plugin?

or virtuemart custom plugin?

what version are you using?



Hi PRO,

Yes i used system plugin, and VM 3.0.6 version, joomla 3.4

Thank you so much !

PRO

why not a virtuemart custom plugin?

WHAT IS IT SUPPOSED TO DO?

baoquocmt159

Quote from: PRO on March 27, 2015, 18:40:17 PM
why not a virtuemart custom plugin?

WHAT IS IT SUPPOSED TO DO?

Hi PRO,

Because i want choose options on the cart page, not productdetail page. Please help me.
@Milbo

Thank you so much !

baoquocmt159

Hello @Milbo, Hello @PRO

How are you?

baoquocmt159

Hello

I have tried :


$data = $this->cart->prepareAjaxData(FALSE);
$prices = $this->getCartPrices();
$prices["billTotal"] += 10;
$this->cart->setCartIntoSession();


But still can't save new price :(

Can someone help me?

Thank a lot !

PRO

baoquocmt159,

describe what your plugin does.

what is the option for?


baoquocmt159

Quote from: PRO on March 30, 2015, 11:46:50 AM
baoquocmt159,

describe what your plugin does.

what is the option for?



Hi PRO,

I have a <select .. option>, when i select option, i use jQuery ajax to php file, in this php file, i want $prices["billTotal"] add 10 (for example), and i did used code :


// load VM config, VM helper cart here.
$data = $this->cart->prepareAjaxData(FALSE);
$prices = $this->getCartPrices();
$prices["billTotal"] += 10;
$this->cart->setCartIntoSession();


But it's still notchange :(

Thank a lot !

PRO

I am not sure how to help with a system plugin.

does this have to do with shipping etc?

Because i know this could easily be done with a shipping plugin


Milbo

baoquocmt159 your way would be very unsecure.What you try does not work in VM. VM recognises it as illegal data manipulation and sets the correct values
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

baoquocmt159

Hi Milbo, PRO

I did solved by myself.

Thanks

likrish

Hi, I know this is a dead thread, however I am looking at the same problems myself and was wondering if you could let me know how you solved the issue, or perhaps let me have a copy of your plugin  :)

Dean
Skype: Datalynk