Bonjour Oncle Fromage !
Je viens d'essayer de réaliser ce dont nous avons parler hier en adaptant à mon cas mais sans succés, je ne doit pas être très doué
J'espère que tu pourra encore m'aider un peu car cela me bloque bcp ..
Je te remercie par avance encore et encore
voici ou j'en suis :
- Les données des Product s'affiche correctement dans la page Product
- Les flashvar fonctionnes
- Le menu Products ne s'affiche pas seul un lien s'affiche mais il ne dirige vers rien
- Je n'arrive pas a donner comme texte aux lienx du menu la valeur Productname : <a href="$Link">$Productname $ID</a> (rien ne s'affiche).
j'ai une page de redirection 'Products' qui renvoi sur la Page 01 donc le site tree ressemble à cela :
PRODUCTS (redirector page>Product 01)
-Product 01 (ProductPage)
-Product 02 (ProductPage)
-Product 03 (ProductPage)
et comme nous l'avions évoqué je voudrait que sur chaque page Product les choses s'affiche ainsi
-------------------- affichage Product X ------------------------
Product 01 - <b>Product 02</b> - Product 03
Productname 02
Contenance 02
Actifs 02
Prix 02
-------------------- affichage Product X ------------------------
voici les codes que j'ai fait
---------------------- Product.php ------------------------------
<?
class Product extends DataObject
{
static $db = array (
'Productname' => 'Text',
'Imagename' => 'Text',
'Presentation' => 'Text',
'Contenance' => 'Text',
'Actifs' => 'Text',
'Price' => 'Text'
);
static $has_one = array (
'ProductPage' => 'ProductPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Productname'),
new TextField('Imagename'),
new TextField('Presentation'),
new TextField('Contenance'),
new TextField('Actifs'),
new TextField('Price')
//new TextareaField('Quote')
);
}
public function Link() {
return $this->ProductPage()->Link("show/$this->ID");
}
}
---------------------- ProductPage.php ------------------------------
<?
class ProductPage extends Page
{
static $has_many = array (
'Products' => 'Product'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.Products", new DataObjectManager(
$this,
'Products',
'Product',
array('Productname'=>'Productname','Imagename'=>'Imagename','Presentation' => 'Presentation','Contenance' => 'Contenance','Actifs' => 'Actifs','Price' => 'Price'),
'getCMSFields_forPopup'
));
return $f;
}
}
class ProductPage_Controller extends Page_Controller
{
public function index() {
return Director::redirect($this->Products()->First()->Link());
}
static $allowed_actions = array (
'show'
);
public function show() {
return array (
'Product' => DataObject::get_by_id("Product",$this->urlParams['ID'])
);
}
}
----------------- ProductPage.ss --------------
<!-- NAVIGATION PRODUCTS -->
<div id="ProductNav">
<% control ProductPage %>
<% control Products %>
<a href="$Link">Contenance $ID</a>
<% end_control %>
<% end_control %>
</div>
<!-- NAVIGATION PRODUCTS -->
<!-- FICHE PRODUCT -->
<div id="Product">
<% control Product %>
Vous avez séléctioné le Product ci-dessous:
$Productname </br>
$Contenance </br>
$Actifs </br>
$Prix </br>
<a href="$Product.Link">$Productname</a>
<% end_control %>
</div>
<!-- FICHE PRODUCT -->
<!-- ANIMATION FLASH -->
<div id="Animation">
<object width="450" height="600" type="application/x-shockwave-flash" data="assets/swf/raineditorial.swf">
<param name="movie" value="assets/swf/raineditorial.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<!--<param name="flashvars" value=$flashvarFunction/>-->
<!-- ANIMATION FLASH -->