Jump to content

Jplayer 2.6.0 dans page produit ?


Recommended Posts

Bonjours a tous.

 

 

Apres l'achat du module "mp3downloadmagavenue" qui marche très bien (installation, gestion des musiques par pages produits etc...) j'ai voulu personnaliser (visuel) ce dernier car pas du tout en lien avec le style de la boutique. Des modifications sont possibles en CSS mais ça reste vraiment basique. 

 

N’ayant pas le fichier .fla du Player (juste le .swf) je me suis vite rendu compte que j'allais devoir passer sur un autre player.

 

Apres de lonnnnngues recherches sur le net, je suis tombé sur le Player "Jplayer" et son skin "flat.audio" qui me semble parfait, mais là sa bug, je n'arrive absolument pas à l’intégrer dans mes pages produits.(product.tpl)

 

Je tiens à préciser que je ne suis pas un "crac" en prestashop et en développement web.

 

 

Donc ma première question: est-il possible d'utiliser Jplayer sur ces pages produits? (attention, chaque pages produits a un extrait de musique différent)

 

 

Si oui, est-il possible de gérer l'association des musiques par fiches produits via le back_office toujours avec Jplayer ?

 

 

ps: dsl si mes questions paraissent "simple" mais j’avoue avoir du mal encore avec prestashop.

 

 

Liens:

 

Page produit: http://www.maoshopper.com/trance/12-freedom.html

 

http://jplayer.org/

 

http://jplayer.it/detail?id=flat.audio.03

 

 

Merci d'avance. 

 

Link to comment
Share on other sites

votre site est en maintenance, en conséquence impossible de voir votre boutique.

Que cherchez vous à faire exactement ?

mettre un player sur la page produit, qui jouera un son différent pour chaque produit OK, mais tout ça resterait independant du produit en vente et du processus "normal" de commande ?

C'est juste une musique qui "accompagne" la fiche produit ?

Link to comment
Share on other sites

Salut chDUP.

Oui je cherche a inclure un player audio pour montrer un extrait du produit vendu, je ne vend pas la musique mais des projets MAO, le player sert donc simplement a accompagné la fiche produit.

Jplayer m’intéresse beaucoup car j'ai déjà le "skin" qui irait avec le visuel du site. 

J'ai réouvert le site au public si vous voulez voir la page produit. http://www.maoshopper.com/trance/12-freedom.html

 

Merci encore.

Link to comment
Share on other sites

ok je vois.

j'ai déjà eu à manipuler jPlayer sur un projet complexe, sur woocommerce.

Je ne connais pas le module "mp3downloadmagavenue" mais à priori il vous permet d'uploader sur la fiche produit votre extrait.

Donc il semble tout à fait possible de garder ça et de modifier juste le template product pour y integrer jPlayer (qui est très modulable)

mais bien sur ça demande du développement.

Dommage que ce player (d'origine du module je suppose) soit en flash, donc incompatible iphone, ipad, ipod

Link to comment
Share on other sites

oui c'est bien (l'un des problèmes) qui me pousse a changer de player (hors mi le coté design) le fait qu'il soit flash. Jplayer etant en HTML5 il serrais bien plus intéressent pour moi.

Effectivement le player de "mp3downloadmagavenue" marche très bien en se qui concerne l’attribution des musiques au fiche produits et j'ai effectivement penser garder ce coté du module et remplacer le player "mp3downloadmagavenue" par "Jplayer", mais la je planche je ne sais même pas si c'est possible. a mon avis il faut retoucher le.tpl du premier player pour qu 'il "tape" sur Jplayer mais se n'est qu une supposition. de tout facon les seuls fichier sont soit le .tpl soit des .php ou alors des xml, (il n y a pas de javascript).

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

coté .tpl sa donne cela:

 

<section class="page-product-box">

<h3 class="idTabHrefShort page-product-heading" id="#idTabMP3">{l s='Musics' mod='mp3downloadmagavenue'}</h3> 
<div id="idTab5">
 
<div id="mp3download">
   {if $productAttributesDownload}
       {foreach from=$productAttributesDownload item=download}
           <div>
               {if $download.physically_demo_filename neq ''}
                   <object type="application/x-shockwave-flash" data="{$pathMusic}player_mp3_maxi.swf" width="200" height="20">
                           <param name="wmode" value="transparent" />
                           <param name="movie" value="{$pathMusic}player_mp3_maxi.swf" />
                           <param name="FlashVars" value="mp3={$pathMusic}demo/{$download.physically_demo_filename}.mp3&bgcolor1=ffffff&bgcolor2=cccccc&buttoncolor=999999&buttonovercolor=0&slidercolor1=cccccc&slidercolor2=999999&sliderovercolor=666666&textcolor=000000&showvolume=1" />
 
<audio controls="controls">
 <source src="{$pathMusic}demo/{$download.physically_demo_filename}.mp3" type="audio/mpeg">
 <p>{l s='Your browser does not support the audio element.' mod='mp3downloadmagavenue'}</p>
</audio> 
                   </object>
               {/if}
                   <span class="mp3_label">{$download.display_filename}</span>
               {if $download.physically_filename neq ''}
                   <span class="mp3_label"> - <a class="btn btn-default button button-small" onclick="$('#idCombination').val({$download.id_product_attribute});$('#add_to_cart .exclusive').click();$('#idCombination').val(0);">{l s='Buy it !' mod='mp3downloadmagavenue'}</a></span>                
               {/if}
           </div>
 
       {/foreach}
   {/if}
</div>
</div>
</section>
 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

et coté .php:

 

<?php
/**
  * mp3downloadmagavenue class, mp3downloadmagavenue.php
  * Download songs when ordering a product
  * @category modules
  *
  * @author Magavenue <[email protected]>
  * @copyright Magavenue
  * @license http://www.opensource.org/licenses/osl-3.0.php Open-source licence 3.0
  * @version 2.0
  * @note  If you want to customize the module, contact us at [email protected]
  */
class Mp3DownloadMagavenue extends Module
{
public function __construct()
{
$this->name = 'mp3downloadmagavenue';
$this->tab = 'front_office_features';
$this->version = '2.0';
$this->module_key = '9f919dbf04f10060a2372d987c269931';
$this->author = 'MagAvenue';
 
parent::__construct();
 
$this->displayName = $this->l('Download songs on a product');
$this->description = $this->l('Download songs from a product');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall ?');
        $this->_path = _MODULE_DIR_.$this->name.'/';
 
}
 
public function install()
{
            $sql='CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'product_attribute_download` (
 `id_product_attribute_download` INT(20) NOT NULL AUTO_INCREMENT,
 `id_product` INT(20) NOT NULL,
 `id_product_attribute` INT(20) NOT NULL,
 `display_filename` VARCHAR(255) NOT NULL,
 `physically_filename` VARCHAR(255) NOT NULL,
 `physically_demo_filename` VARCHAR(255) NOT NULL,
 `date_deposit` DATETIME NOT NULL,
 `date_expiration` DATETIME NOT NULL,
 `nb_days_accessible` INT(10) NOT NULL,
 `nb_downloadable` INT(10) NOT NULL,
 `active` tinyint(1) NOT NULL,
 PRIMARY KEY (`id_product_attribute_download`)
);';
 
            if (
    !parent::install() 
    OR !Db::getInstance()->Execute($sql)
                OR !$this->installModuleTab('AdminMp3DownloadMagavenue', $this->l('MP3'), 9)
                OR !$this->registerHook('productfooter')
    )
return false;
return true;
}
        
        public function hookExtraRight($params)
        {
            return $this->hookProductFooter($params);
        }
 
public function hookExtraLeft($params)
{
return $this->hookProductFooter($params);
}
        
        // tab install
private function installModuleTab($tabClass, $tabName, $idTabParent)
{
@copy(_PS_MODULE_DIR_.$this->name.'/logo.gif', _PS_IMG_DIR_.'t/'.$tabClass.'.gif');
$tab = new Tab();
 
$tabName = Array();
foreach (Language::getLanguages(false) as $lang)
$tabName[$lang['id_lang']] = 'MP3';
 
$tab->name = $tabName;
$tab->class_name = $tabClass;
$tab->module = $this->name;
$tab->id_parent = $idTabParent;
if(!$tab->save())
return false;
return true;
}
 
// tab uninstall
private function uninstallModuleTab($tabClass)
{
$idTab = Tab::getIdFromClassName($tabClass);
if($idTab != 0) {
$tab = new Tab($idTab);
$tab->delete();
return true;
}
return false;
}
        
    public function hookProductFooter($params)
    {
        //get the songs from a product
        include_once(_PS_MODULE_DIR_.'mp3downloadmagavenue/ProductAttributeDownload.php');
        $productAttributesDownload = ProductAttributeDownload::getProductAttributesDownloadFromIdProduct((int)Tools::getValue('id_product'));
        
        $this->context->smarty->assign(array(
                            'productAttributesDownload' => $productAttributesDownload,
                            'pathMusic' => $this->_path,
                            'flash' => (int)Configuration::get('MP3_FLASH')
                        ));
 
        return $this->display(__FILE__, 'mp3downloadmagavenue.tpl');
    }
 
public function uninstall()
{
$sql ='DROP TABLE `'._DB_PREFIX_.'product_attribute_download`;';
if (
!parent::uninstall() 
                        OR !$this->uninstallModuleTab('AdminMp3DownloadMagavenue')
OR !Db::getInstance()->Execute($sql)
)
return false;
return true;
}
        
        public function displayConf($message = null)
{
$this->_html .= '
<div class="conf confirm">
'.$message.'
</div>';
}
 
        
        public function getContent(){
            $this->_html = '<h2>'.$this->displayName.'</h2>';
            if (Tools::getIsset('submitForm'))
            {
                Configuration::updateValue('MP3_GROUP_DEFAULT', (int)Tools::getValue('MP3_GROUP_DEFAULT'));
                Configuration::updateValue('MP3_FLASH', (int)Tools::getValue('MP3_FLASH'));
                $this->displayConf( $this->l('Configuration updated') );
            }
 
            $this->displayFormSettings();
            return $this->_html;
}
 
 
 
        public function displayFormSettings(){
            $this->_html .= '
            <form action="'.$_SERVER['REQUEST_URI'].'" method="post">
            <fieldset>
                    <legend><img src="../img/admin/contact.gif" />'.$this->l('Settings').'</legend>
 
                    <label for="MP3_GROUP_DEFAULT">'.$this->l('Default attribute group ID').' : </label>
                    <div class="margin-form">
                        <select id="MP3_GROUP_DEFAULT" name="MP3_GROUP_DEFAULT">
                        ';
                        $default = (int)Configuration::get('MP3_GROUP_DEFAULT');
                        $groups = AttributeGroup::getAttributesGroups((int)$this->context->cookie->id_lang);
                        
                        if($groups)
                            foreach($groups as $group)
                                $this->_html.='<option value="'.$group['id_attribute_group'].'"'.($default==$group['id_attribute_group']?' selected="selected"':'').'>'.$group['public_name'].'</option>';
            $this->_html .= '
                        </select>
                        <p>'.$this->l('We will use this group to create product attributes').'</p>
                    </div>
 
                    <label for="MP3_FLASH">'.$this->l('Player').' : </label>
                    <div class="margin-form">
                        <select id="MP3_FLASH" name="MP3_FLASH">
                        <option value="0"'.((int)Configuration::get('MP3_FLASH')==0?' selected="selected"':'').'>HTML5</option>
                        <option value="1"'.((int)Configuration::get('MP3_FLASH')==1?' selected="selected"':'').'>Flash</option>
                        </select>
                        <p>'.$this->l('Select the type of the music player').'</p>
                    </div>
                    
 
 
                    <br /><center><input type="submit" name="submitForm" value="'.$this->l('Update settings').'" class="button" /></center>
            </fieldset>
            </form>';
}
}
?>
 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Es ce que je regard dans le bon fichiers d’après vous ?
Link to comment
Share on other sites

dans votre php vous avez une function hookProductFooter qui s'accroche au hook de la page produit.

Elle utilise mp3downloadmagavenue.tpl en créant notamment une variable smarty "pathMusic"

Il faut donc réécrire totalement ce tpl en y integrant le player JPlayer.

et voir la valeur de pathMusic, à priori elle  contient uniquement le chemin vers tous vos extraits, et c'est probablement productAttributesDownload qui sera l'id du fichier à jouer.

 

Il vous faudra aussi créer une function pour hooker le module dans le header pour y inserer le code js de Jplayer.

Edited by ChDUP (see edit history)
Link to comment
Share on other sites

merci pour vos précisions, je vais m y attaquer de-suite.

J'ai en même temps demandé l'aide de magavenue qui propose un service (payant je pense) de "personnalisation de module acheté. Je verrais bien.

merci encore.

Link to comment
Share on other sites

  • 9 months later...

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...