Moderator: madimar

Post by virussino » Thu Jun 16, 2016 5:54 am

Ciao a tutti, avrei bisogno di sapere quale comando inserire in un bottone per far si che l'email scritta in un INPUT si inserisca nelle email della newsletter...

L'url dovrebbe essere questo se non sbaglio..

index.php?route=module/newslettersubscribe/subscribe

Qualcuno sa aiutarmi? ^^

Grazie :)

Eco-friendly Clothing Store for Man and Woman, with a wide selection of Vegan and Made in Italy clothing, bags, underwear. http://www.vestilanatura.it for join the sustainable lifestyle!


User avatar
New member

Posts

Joined
Wed Jul 08, 2015 12:13 am


Post by raikage » Thu Jun 16, 2016 1:16 pm

fammi capire bene,vorresti inserire un bottone con link a quell'url,così che i clienti cliccando sul pulsante si iscrivano?

https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm

Post by virussino » Thu Jun 16, 2016 10:02 pm

raikage wrote:fammi capire bene,vorresti inserire un bottone con link a quell'url,così che i clienti cliccando sul pulsante si iscrivano?


Si esatto, in pratica nel template (nel footer) è già disponibile un modulo di newsletter.
Io ho bisogno di quel modulo al centro di una pagina dedicata, ma deve rimanere anche nel footer. Ho provato copia incolla del codice, ma ovviamente vanno in conflitto (anche cambiando i nomi delle funzioni, probabilmente sbaglio qualcosa). Quindi ho pensato di creare un nuovo <input> dove il cliente inserisce l'email, e sotto un bottone che serve per salvarla.

In pratica questo..

http://www.vestilanatura.it/richiesta-email


edit: chiaramente ho creato un layout con il modulo newsletter in content top, e funziona benissimo, ma non mi piace graficamente, quindi preferisco crearne uno nuovo

Eco-friendly Clothing Store for Man and Woman, with a wide selection of Vegan and Made in Italy clothing, bags, underwear. http://www.vestilanatura.it for join the sustainable lifestyle!


User avatar
New member

Posts

Joined
Wed Jul 08, 2015 12:13 am


Post by raikage » Thu Jun 16, 2016 11:00 pm

quello che ti serve e creare un nuovo form per la newsletter,hai 2 possibilità o ne crei uno tu in html e php oppure ti copi il codice del template e lo modifichi.
devi aggiungere anche un piccolo script java che ha la funzione di sottoscrizione e cancellazione.

Code: Select all

<script type="text/javascript"><!--
function email_subscribe(){
	$.ajax({
			type: 'post',
			url: 'index.php?route=module/newslettersubscribe/subscribe',
			dataType: 'html',
            data:$("#subscribe").serialize(),
			success: function (html) {
				eval(html);
			}
	}); 
}
function email_unsubscribe(){
	$.ajax({
			type: 'post',
			url: 'index.php?route=module/newslettersubscribe/unsubscribe',
			dataType: 'html',
            data:$("#subscribe").serialize(),
			success: function (html) {
				eval(html);
			}
	}); 
}
$('.newsletter input[class=\'form-control\']').on('keydown', function(e) {
		$('.newsletter input[class=\'form-control\']').parent().find('a').trigger('click');
	}
});
//--></script>
devi modificare la class url sia in subscribe che in unsubscribe devi mettere la url alla tua newsletter.
poi devi creare lo schema in html e successivamente la parte in php dove la colleghi al form html

codice html

Code: Select all

<form style="margin:0px;padding:0px;" method="post" action="http://www.esempio/u.php">
<p><input type="text" name="u" value="" /></p>
<p><input type="submit" value="Iscriviti" />
<input type="hidden" name="l" value="Predefinita" />
<input type="hidden" name="cmd" value="subscribe" />
<input type="hidden" name="r" value="http://www.esempio.com" /></p>
</form>
nella parte

Code: Select all

method="post" action="http://www.esempio/u.php">
indica al form quale pagina deve caricare.
i miei sono solo esempi, poi se hai un po di fantasia con un po di css puoi fare qualcosa di più carino.

https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm

Post by virussino » Fri Jun 17, 2016 4:58 am

Questo è il codice del template:

Code: Select all

<div class="newsletter-content">
		<div id="frm_subscribe">
			<form name="subscribe" id="subscribe">
				<table>
				   <tbody><tr>
					 <td>
						<div class="boss-newsletter">
						<input class="form-control input-new" size="50" placeholder="Put your email address here" name="subscribe_email" id="subscribe_email" type="text"> 
						<a class="btn btn-new" onclick="email_subscribe()">Subscribe</a>
						</div>
					</td>
					</tr>
					<tr style="display:none;">
					 <td><input class="form-control input-new" size="50" value="Put your email address here" name="subscribe_name" id="subscribe_name" type="text"></td>
					</tr>
					<tr>		
					 <td id="subscribe_result"></td>
				   </tr>
				   					  
				</tbody></table>
			</form>
		</div>
	</div>
Quando lo utilizzo piazzandolo al centro della pagina, mi dice "Invalid email", ma se scrivo l'email nel box presente nel footer, e poi clicco qui su Subscribe, funziona.
In pratica va a cercare l'email nel campo footer piuttosto che in questo.



E questo sarebbe lo script..

Code: Select all


<!--
function email_subscribe(){
	$.ajax({
			type: 'post',
			url: 'index.php?route=module/newslettersubscribe/subscribe',
			dataType: 'html',
            data:$("#subscribe").serialize(),
			success: function (html) {
				eval(html);
			}
	}); 
}
function email_unsubscribe(){
	$.ajax({
			type: 'post',
			url: 'index.php?route=module/newslettersubscribe/unsubscribe',
			dataType: 'html',
            data:$("#subscribe").serialize(),
			success: function (html) {
				eval(html);
			}
	}); 
}
$('.boss-newsletter input[class=\'form-control\']').on('keydown', function(e) {
	if (e.keyCode == 13) {
		$('.boss-newsletter input[class=\'form-control\']').parent().find('a').trigger('click');
	}
});
//-->


Secondo me basta cambiare i nomi delle funzioni, ma ci sto provando e non riesco a farlo funzionare..hai qualche dritta in merito?

Grazie

Eco-friendly Clothing Store for Man and Woman, with a wide selection of Vegan and Made in Italy clothing, bags, underwear. http://www.vestilanatura.it for join the sustainable lifestyle!


User avatar
New member

Posts

Joined
Wed Jul 08, 2015 12:13 am


Post by raikage » Fri Jun 17, 2016 12:52 pm

devi anche controllare il codice nel file di controller,se il codice html sta nel footer allora devi andare a prendere il file catalog/controller/common/footer.php e lo apri con l'editor di testo e cerchi il codice newsletter.
altrimenti devi vedere nei file del template se c'è qualche file chiamato newsletter.

https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm

Post by raikage » Fri Jun 17, 2016 5:51 pm

guarda se ti va bene una cosa così che ti do il file vqmod e i relativi files php da copiare nella root.

http://www.informaticazone.it/demo/ocart2/

https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm

Post by virussino » Fri Jun 17, 2016 7:08 pm

Si perfetto, dovrei solo apportare qualche modifica (farlo più grande), penso di poterci riuscire ;)
Grazie mille

Eco-friendly Clothing Store for Man and Woman, with a wide selection of Vegan and Made in Italy clothing, bags, underwear. http://www.vestilanatura.it for join the sustainable lifestyle!


User avatar
New member

Posts

Joined
Wed Jul 08, 2015 12:13 am


Post by raikage » Fri Jun 17, 2016 7:58 pm

ok allora ti passo il file zippato.

https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm

Post by raikage » Fri Jun 17, 2016 9:37 pm

attaccato trovi lo zip contenente i file per la newsletter.

Attachments

newsletter subscription


https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm

Post by virussino » Fri Jun 17, 2016 10:23 pm

raikage wrote:attaccato trovi lo zip contenente i file per la newsletter.

Grazie mille, però mi sorge un dubbio, utilizzando questo modulo vado a separare le due newsletter? Cioè quello del template le salva da una parte, mentre questo da un'altra giusto?

Eco-friendly Clothing Store for Man and Woman, with a wide selection of Vegan and Made in Italy clothing, bags, underwear. http://www.vestilanatura.it for join the sustainable lifestyle!


User avatar
New member

Posts

Joined
Wed Jul 08, 2015 12:13 am


Post by raikage » Fri Jun 17, 2016 10:36 pm

certo leggiti le istruzioni all'interno

https://www.opencartitalia.org
Consulenza,Sviluppo Extension per: Opencart,Magento,Prestahop,Wordpress,Ocart,Zencart,Joomla,Multimerch e SEO Specialist Certified

Info e Contatti

Image


User avatar
Active Member

Posts

Joined
Mon Jun 03, 2013 3:04 pm
Who is online

Users browsing this forum: No registered users and 111 guests