Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter ValerioCappelli

    (@valeriocappelli)

    I try add in file product.tpl this:

    <!-- PRODUCT DEMO -->
    			<tpl ifset="product.demo">
    				<div class="single">
    				{product.demo}
    				</div>
    			</tpl ifset="product.demo">

    but in my post not show a player audio and crash all display align.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    In this case the changes are not as simple as paste the snippet of code in the template file, it is required, but not the only thing.

    Please, after edit the template file, open the “/wp-content/plugins/sell-downloads/sd-core/sd-product.php” file with the text editor your choice, and move the following snippet of code:

    $demo = $this->demo;

    if( !empty( $demo ) ){
    $ext = pathinfo( $demo, PATHINFO_EXTENSION );
    $type = ”;
    $class = ”;

    if( !empty( $ext ) && get_option( ‘sd_online_demo’, SD_ONLINE_DEMO) ){
    switch( strtolower( $ext ) ){
    case ‘pdf’:
    $type = ‘application/pdf’;
    break;
    case ‘ps’:
    $type = ‘application/postscript’;
    break;
    case ‘odt’:
    $type = ‘application/vnd.oasis.opendocument.text’;
    break;
    case ‘ods’:
    $type = ‘application/vnd.oasis.opendocument.spreadsheet’;
    break;
    case ‘odp’:
    $type = ‘application/vnd.oasis.opendocument.presentation’;
    break;
    case ‘sxw’:
    $type = ‘application/vnd.sun.xml.writer’;
    break;
    case ‘sxc’:
    $type = ‘application/vnd.sun.xml.calc’;
    break;
    case ‘sxi’:
    $type = ‘application/vnd.sun.xml.impress’;
    break;
    case ‘doc’:
    case ‘docx’:
    $type = ‘application/msword’;
    break;
    case ‘xls’:
    $type = ‘application/vnd.ms-excel’;
    break;
    case ‘ppt’:
    $type = ‘application/vnd.ms-powerpoint’;
    break;
    case ‘rtf’:
    $type = ‘text/rtf’;
    break;
    case ‘txt’:
    $type = ‘text/plain’;
    break;
    case ‘wav’:
    case ‘mp3’:
    case ‘ogg’:
    case ‘mid’:
    $type = ‘audio’;
    break;
    case ‘mpg’:
    case ‘avi’:
    case ‘wmv’:
    case ‘mov’:
    case ‘mp4’:
    case ‘m4v’:
    case ‘flv’:
    $type = ‘video’;
    break;

    }
    }

    if( !empty( $type ) ){

    switch( $type ){
    case ‘audio’:
    $product_data[‘demo’] = ‘
    <audio class=”sd-demo-media” src=”‘.$demo.'”></audio>
    ‘;
    break;
    case ‘video’:
    $product_data[‘demo’] = ‘
    <video class=”sd-demo-media” src=”‘.$demo.'”></video>
    ‘;
    break;
    default:
    $type = ‘mtype=”‘.$type.'”‘;
    $class = ‘class=”sd-demo-link”‘;
    $product_data[‘demo’] = ‘‘.__(‘View File Demo’, SD_TEXT_DOMAIN).’‘;
    }
    } else {
    $product_data[‘demo’] = ‘‘.__(‘Download File Demo’, SD_TEXT_DOMAIN).’‘;
    }
    } else {
    $product_data[‘demo’] = ”;
    }

    To the line above the conditional statement:

    if($mode == ‘store’ || $mode == ‘multiple’){

    and don’t forget to check the option: “Allow display online demos” in the settings page of the store.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Yes, but would be needed edit the plugin’s code, please, read the answer published in the other ticket about this question.

    Best regards.

    Thread Starter ValerioCappelli

    (@valeriocappelli)

    Done but not working.

    Now my function is:

    function display_content($mode, $tpl_engine, $output='echo'){
                $action  = SD_H_URL.'?sd_action=buynow';
    			$product_data = array(
    				'title' => $this->post_title,
    				'cover' => $this->cover,
    				'link'	=> get_permalink($this->id),
    				'popularity' => $this->plays,
                    'social' => null,
                    'price' => null,
    				'has_types' => null
    			);
    
                if(get_option('sd_social_buttons')){
                    $product_data['social'] = get_permalink( $this->id );
                }
    
                if($this->time) $product_data['time'] = $this->time;
    			if($this->year) $product_data['year'] = $this->year;
    			if($this->info) $product_data['info'] = $this->info;
    
                if(count($this->type)){
    				$product_data['has_types'] = true;
    				$artists = array();
    				foreach($this->type as $type){
    					$types[] = array('data' => '<a href="'.get_term_link($type).'">'.$type->name.'</a>');
    				}
    				$tpl_engine->set_loop('types', $types);
    			}
    
                if(!empty($this->file)){
                    if(get_option('sd_paypal_enabled') && get_option('sd_paypal_email') && !empty($this->price)){
                        $currency_symbol = get_option('sd_paypal_currency_symbol', SD_PAYPAL_CURRENCY_SYMBOL);
                        $product_data['price'] = ((!empty($currency_symbol)) ? $currency_symbol.sprintf("%.2f", $this->price) : sprintf("%.2f", $this->price).get_option('sd_paypal_currency', SD_PAYPAL_CURRENCY));
                        $paypal_button = SD_URL.'/paypal_buttons/'.get_option('sd_paypal_button', SD_PAYPAL_BUTTON);
                        $product_data['salesbutton'] = '<form action="'.$action.'" method="post"><input type="hidden" name="sd_product_type" value="single" /><input type="hidden" name="sd_product_id" value="'.$this->id.'" /><input type="image" src="'.$paypal_button.'" style="padding-top:5px;" /></form>';
                    }else{
                        $product_data['salesbutton']  = '<a href="'.$this->file.'" target="_blank">'.__('Download Here', SD_TEXT_DOMAIN).'</a>';
                    }
                }
    							$demo = $this->demo;
    
    				if( !empty( $demo ) ){
    					$ext = pathinfo( $demo, PATHINFO_EXTENSION );
    					$type = '';
    					$class = '';
    
    					if( !empty( $ext ) && get_option( 'sd_online_demo', SD_ONLINE_DEMO) ){
    						switch( strtolower( $ext ) ){
    							case 'pdf':
    								$type = 'application/pdf';
    							break;
    							case 'ps':
    								$type = 'application/postscript';
    							break;
    							case 'odt':
    								$type = 'application/vnd.oasis.opendocument.text';
    							break;
    							case 'ods':
    								$type = 'application/vnd.oasis.opendocument.spreadsheet';
    							break;
    							case 'odp':
    								$type = 'application/vnd.oasis.opendocument.presentation';
    							break;
    							case 'sxw':
    								$type = 'application/vnd.sun.xml.writer';
    							break;
    							case 'sxc':
    								$type = 'application/vnd.sun.xml.calc';
    							break;
    							case 'sxi':
    								$type = 'application/vnd.sun.xml.impress';
    							break;
    							case 'doc':
    							case 'docx':
    								$type = 'application/msword';
    							break;
    							case 'xls':
    								$type = 'application/vnd.ms-excel';
    							break;
    							case 'ppt':
    								$type = 'application/vnd.ms-powerpoint';
    							break;
    							case 'rtf':
    								$type = 'text/rtf';
    							break;
    							case 'txt':
    								$type = 'text/plain';
    							break;
    							case 'wav':
    							case 'mp3':
    							case 'ogg':
    							case 'mid':
    								$type = 'audio';
    							break;
    							case 'mpg':
    							case 'avi':
    							case 'wmv':
    							case 'mov':
    							case 'mp4':
    							case 'm4v':
    							case 'flv':
    								$type = 'video';
    							break;
    
    						}
    					}
    
    					if( !empty( $type ) ){
    
    						switch( $type ){
    							case 'audio':
    								$product_data['demo'] = '<br /><audio class="sd-demo-media" src="'.$demo.'"></audio><br />';
    							break;
    							case 'video':
    								$product_data['demo'] = '<br /><video class="sd-demo-media" src="'.$demo.'"></video><br />';
    							break;
    							default:
    								$type = 'mtype="'.$type.'"';
    								$class = 'class="sd-demo-link"';
    								$product_data['demo'] = '<a href="/?sd_action=demo&file='.urlencode($demo).'" target="_blank" '.$type.' '.$class.' >'.__('View File Demo', SD_TEXT_DOMAIN).'</a>';
    						}
    					} else {
    						$product_data['demo'] = '<a href="/?sd_action=demo&file='.urlencode($demo).'" target="_blank" '.$type.' '.$class.' >'.__('Download File Demo', SD_TEXT_DOMAIN).'</a>';
    					}
    				} else {
    					$product_data['demo'] = '';
    				}
    			if($mode == 'store' || $mode == 'multiple'){
    				if($mode == 'store')
    					$tpl_engine->set_file('product', 'product.tpl.html');
    				else
    					$tpl_engine->set_file('product', 'product_multiple.tpl.html');
    
    				$tpl_engine->set_var('product', $product_data);
    			}elseif($mode == 'single'){
    				$this->plays += 1;
    				$tpl_engine->set_file('product', 'product_single.tpl.html');
    				$sd_main_page = get_option('sd_main_page', SD_MAIN_PAGE);
    				if($sd_main_page){
    					$product_data['store_page'] = $sd_main_page;
    				}
    
    				if(strlen($this->post_content)){
    					$product_data['description'] 	= '<p>'.preg_replace('/[\n\r]+/', '</p><p>', $this->post_content).'</p>';
    				}	
    
    				$tpl_engine->set_var('product', $product_data);
    			}
    
    			return $tpl_engine->parse('product', $output);
    		} // End display

    And my template:

    <div class="sell-downloads-product">
    	<div class="left-column">
    		<!-- PRODUCT COVER -->
    		<tpl ifset="product.cover">
    		<div class="product-cover">
    			<a href="{product.link}">
    			<img src="{product.cover}">
    			</a>
    		</div>
    		</tpl ifset="product.cover">
    	</div>
    
    	<div class="right-column">
    		<!-- PRODUCT TITLE -->
    		<tpl ifset="product.title">
    		<div class="product-title">
    			<a href="{product.link}">
    			{product.title}
    			</a>
    		</div>
    		</tpl ifset="product.title">
    
    		<!-- PRODUCT TYPE -->
    		<tpl ifset="product.has_types">
    			<div class="product-type">
    				<ul>
    				<tpl loop="types">
    					<li><span class="arrow">?</span>{types.data}</li>
    				</tpl loop="types">
    				</ul>
    			</div>
    		</tpl ifset="product.has_types">
    
    		<!-- PRODUCT POPULARITY -->
    		<tpl ifset="product.popularity">
    			<div class="product-popularity">
    			<span class="label">popularity: </span> {product.popularity}
    			</div>
    		</tpl ifset="product.popularity">
    
    		<!-- PRODUCT PRICE -->
    		<tpl ifset="product.price">
    			<div class="product-price">
    			{product.price}
    			</div>
    		</tpl ifset="product.price">
                <!-- PRODUCT DEMO -->
    			<tpl ifset="product.demo">
    				<div class="single">
    				{product.demo}
    				</div>
    			</tpl ifset="product.demo">
    			<!-- SELL DOWNLOADS LINK -->
    			<tpl ifset="product.store_page">
    				<div class="sell-downloads-link">
    					<a href="{product.store_page}"> Go to the store page </a>
    				</div>
    			</tpl ifset="product.store_page">
    		<!-- PRODUCT SALES BUTTONS -->
    		<tpl ifset="product.salesbutton">
    			<div class="product-payment-buttons">
    			{product.salesbutton}
    			</div>
    		</tpl ifset="product.salesbutton">
    	</div>
        <div style="clear:both;"></div>
    </div>
    Plugin Author codepeople

    (@codepeople)

    Hi,

    The template used in the store’s page is the product.tpl.html file, and not the product_single.tpl.html file.

    Best regards.

    Thread Starter ValerioCappelli

    (@valeriocappelli)

    Yes, the code that i posted is my template file: product_single.tpl.html.

    <div class="sell-downloads-product">
    	<!-- PRODUCT COVER -->
    	<tpl ifset="product.cover">
    	<div class="product-cover">
    		<a href="{product.link}">
    		<img src="{product.cover}">
    		</a>
    	</div>
    	</tpl ifset="product.cover">
    
    	<div class="product-data">
            <!-- PRODUCT TITLE -->
            <tpl ifset="product.title">
            <div class="product-title">
                <a href="{product.link}">
                {product.title}
                </a>
            </div>
            </tpl ifset="product.title">
    
            <!-- PRODUCT TYPE -->
            <tpl ifset="product.has_types">
                <div class="product-type">
                    <ul>
                    <tpl loop="types">
                        <li><span class="arrow">?</span>{types.data}</li>
                    </tpl loop="types">
                    </ul>
                </div>
            </tpl ifset="product.has_types">
    
            <!-- PRODUCT POPULARITY -->
            <tpl ifset="product.popularity">
                <div class="product-popularity">
                <span class="label">popularity: </span> {product.popularity}
                </div>
            </tpl ifset="product.popularity">
    
            <!-- PRODUCT PRICE -->
            <tpl ifset="product.price">
                <div class="product-price">
                {product.price}
                </div>
            </tpl ifset="product.price">
                <!-- PRODUCT DEMO -->
    			<tpl ifset="product.demo">
    				<div class="single">
    				{product.demo}
    				</div>
    			</tpl ifset="product.demo">
    			<!-- SELL DOWNLOADS LINK -->
    			<tpl ifset="product.store_page">
    				<div class="sell-downloads-link">
    					<a href="{product.store_page}"> Go to the store page </a>
    				</div>
    			</tpl ifset="product.store_page">
            <!-- PRODUCT SALES BUTTONS -->
            <tpl ifset="product.salesbutton">
                <div class="product-payment-buttons">
                {product.salesbutton}
                </div>
            </tpl ifset="product.salesbutton">
        </div>
    </div>

    I have no idea why not show a demo streaming

    Thread Starter ValerioCappelli

    (@valeriocappelli)

    If u want i can share my file and link of demo site

    Thread Starter ValerioCappelli

    (@valeriocappelli)

    I’m sorry guys! My bad!

    In the wrong place I’ve overwritten the file! It Works!

    Thank you again!

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Excellent !!! ??

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Streaming audio on List of element’ is closed to new replies.