Bonjour,

- Je travaille avec joomla/virtuemart 1.5.
- Mon objectif est d'ajouter des paramétrés en plus de la quantité dans l'ajout au panier.

question 1: Je voudrais savoir comment et dans quel fichiers est postée et récupérée la variable "quantity" dans le formulaire du fichier addtocart.tpl.php

question 2: Y a t il d'autres fichiers qui participent dans l'ajout de produits dans le petit panier?

Entête du formulaire:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<form action="<?php echo $mm_action_url ?>index.php" method="post" name="addtocart" id="<?php echo uniqid('addtocart_') ?>" class="addtocart_form" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) ) { echo 'onsubmit="handleAddToCart( this.id );return false;"'; } ?>>

le champs quantity:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<input type="text" name="quantity" id="quantity" size="29%" />

Voici le code de handleAddToCart qui est dans le fichier theme.js

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function handleAddToCart( formId, parameters ) {
	formCartAdd = document.getElementById( formId );			
		var callback = function(responseText) {
			updateMiniCarts();
			// close an existing mooPrompt box first, before attempting to create a new one (thanks wellsie!)
			if (document.boxB) {
				document.boxB.close();
				clearTimeout(timeoutID);
			}
 
			document.boxB = new MooPrompt(notice_lbl, responseText, {
					buttons: 2,
					width:400,
					height:150,
					overlay: false,
					button1: ok_lbl,
					button2: cart_title,
					onButton2: 	handleGoToCart
				});
 
			setTimeout( 'document.boxB.close()', 12000 );
		}
 
		var opt = {
			// Use POST
			method: 'post',
			// Send this lovely data
			data: $(formId),
			// Handle successful response
			onComplete: callback,
 
			evalScripts: true
		}
 
		new Ajax(formCartAdd.action, opt).request();
 
 
}
et le code de updateMiniCarts toujours dans le fichier theme.js
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* This function searches for all elements with the class name "vmCartModule" and
* updates them with the contents of the page "shop.basket_short" after a cart modification event
*/
function updateMiniCarts() {
	var callbackCart = function(responseText) {
		carts = $$( '.vmCartModule' );
		if( carts ) {
			try {
				for (var i=0; i<carts.length; i++){
					carts[i].innerHTML = responseText;
 
					try {
						color = carts[i].getStyle( 'color' );
						bgcolor = carts[i].getStyle( 'background-color' );
						if( bgcolor == 'transparent' ) {
							// If the current element has no background color, it is transparent.
							// We can't make a highlight without knowing about the real background color,
							// so let's loop up to the next parent that has a BG Color
							parent = carts[i].getParent();
							while( parent && bgcolor == 'transparent' ) {
								bgcolor = parent.getStyle( 'background-color' );
								parent = parent.getParent();
							}
						}
						var fxc = new Fx.Style(carts[i], 'color', {duration: 1000});
						var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000});
 
						fxc.start( '#222', color );				
						fxbgc.start( '#fff68f', bgcolor );
						if( parent ) {
							setTimeout( "carts[" + i + "].setStyle( 'background-color', 'transparent' )", 1000 );
						}
					} catch(e) {}
				}
			} catch(e) {}
		}
	}
	var option = { method: 'post', onComplete: callbackCart, data: { only_page:1,page: "shop.basket_short", option: "com_virtuemart" } }
	new Ajax( live_site + '/index2.php', option).request();
}
Un autre fichier intervient dans ce module "shop.basket_short.php" pour préparer les variables à afficher

Et pour afficher le petit panier à gauche c'est le fichier minicart.tpl.php


Merci.

Cordialement,