<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NemoPS &#187; address</title>
	<atom:link href="http://nemops.com/tag/address/feed/" rel="self" type="application/rss+xml" />
	<link>http://nemops.com</link>
	<description>Prestashop Tutorials, Modules and More!</description>
	<lastBuildDate>Wed, 05 Dec 2018 13:25:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.35</generator>
	<item>
		<title>New module: &#8220;Address Fields&#8221; just released!</title>
		<link>http://nemops.com/new-module-prestashop-address-fields-released/</link>
		<comments>http://nemops.com/new-module-prestashop-address-fields-released/#comments</comments>
		<pubDate>Mon, 27 Nov 2017 11:09:09 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[thirtybees]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3104</guid>
		<description><![CDATA[<p>If you need to add new fields to the customer addresses in PrestaShop or ThirtyBees, this module will make your life a lot easier, with its automated process! Get it here Watch the video guide Core features Unlimited fields: Add as many new fields as you like Multiple input types: Choose between text, textarea or [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/new-module-prestashop-address-fields-released/">New module: &#8220;Address Fields&#8221; just released!</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you need to add new fields to the customer addresses in PrestaShop or ThirtyBees, this module will make your life a lot easier, with its automated process!<br />
<span id="more-3104"></span><br />
<a style="text-align:center" class="button style1" title="Get the PrestaShop Address Fields Module here" href="http://store.nemops.com/modules/45-prestashop-address-fields.html#.WhvvvEqWaUk">Get it here</a></p>
<h2>Watch the video guide</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/epnxI42c9ek" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<div class="separator"></div>
<h3>Core features</h3>
<ul>
<li><strong>Unlimited fields</strong>: Add as many new fields as you like</li>
<li>Multiple input types: <strong>Choose between text, textarea or select box</strong> to perfectly fit the type of data you require from your customers</li>
<li>Customizable format</li>
<li>Choose if you want to display the fields in the back office list as well</li>
<li>Multilanguage labels</li>
</ul>
<p>The post <a rel="nofollow" href="http://nemops.com/new-module-prestashop-address-fields-released/">New module: &#8220;Address Fields&#8221; just released!</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/new-module-prestashop-address-fields-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add the state to your Shop&#8217;s Address in PrestaShop Invoices</title>
		<link>http://nemops.com/add-the-state-to-your-shops-address-in-prestashop-invoices/</link>
		<comments>http://nemops.com/add-the-state-to-your-shops-address-in-prestashop-invoices/#comments</comments>
		<pubDate>Wed, 31 May 2017 10:37:45 +0000</pubDate>
		<dc:creator><![CDATA[Nemo]]></dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[invoice]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[prestashop modules]]></category>
		<category><![CDATA[shop]]></category>

		<guid isPermaLink="false">http://nemops.com/?p=3030</guid>
		<description><![CDATA[<p>PrestaShop&#8217;s invoices always lacked the state in the shop&#8217;s address information. Let&#8217;s see how to take it back! Watch the screencast Text Version Assigning the state id to the shop&#8217;saddress Open up OrderInvoice.php, located in classes/order. Locate the method named getCurrentFormattedShopAddress, it&#8217;s the one responsible for creating the shop&#8217;s address in the invoice. You will [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://nemops.com/add-the-state-to-your-shops-address-in-prestashop-invoices/">Add the state to your Shop&#8217;s Address in PrestaShop Invoices</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>PrestaShop&#8217;s invoices always lacked the state in the shop&#8217;s address information. Let&#8217;s see how to take it back!</p>
<p><span id="more-3030"></span></p>
<h2>Watch the screencast</h2>

	<div class="video-embed">
		<iframe width="640" height="360" src="http://www.youtube.com/embed/JLRw0abi3G0" frameborder="0" allowfullscreen></iframe><p><a href="https://www.youtube.com/user/NemoPostScriptum/videos" rel="nofollow" title="Subscribe Post Scriptum's Youtube Channel">Subscribe Post Scriptum's Youtube Channel</a></p>	</div>
<h2>Text Version</h2>
<h3>Assigning the state id to the shop&#8217;saddress</h3>
<p>Open up <strong>OrderInvoice.php</strong>, located in <em>classes/order</em>. Locate the method named <strong>getCurrentFormattedShopAddress</strong>, it&#8217;s the one responsible for creating the shop&#8217;s address in the invoice. You will notice that there is no &#8220;id_state&#8221; assigned to the address object, so what we need to do is append the following line:</p>
<pre class="brush: php; title: ; notranslate">
$address-&gt;id_state = Configuration::get('PS_SHOP_STATE_ID', null, null, $id_shop);
</pre>
<p>Right after the $address->id_country one. The end result will look like this:</p>
<pre class="brush: php; title: ; notranslate">
    public static function getCurrentFormattedShopAddress($id_shop = null)
    {
        $address = new Address();
        $address-&gt;company = Configuration::get('PS_SHOP_NAME', null, null, $id_shop);
        $address-&gt;address1 = Configuration::get('PS_SHOP_ADDR1', null, null, $id_shop);
        $address-&gt;address2 = Configuration::get('PS_SHOP_ADDR2', null, null, $id_shop);
        $address-&gt;postcode = Configuration::get('PS_SHOP_CODE', null, null, $id_shop);
        $address-&gt;city = Configuration::get('PS_SHOP_CITY', null, null, $id_shop);
        $address-&gt;phone = Configuration::get('PS_SHOP_PHONE', null, null, $id_shop);
        $address-&gt;id_country = Configuration::get('PS_SHOP_COUNTRY_ID', null, null, $id_shop);
        $address-&gt;id_state = Configuration::get('PS_SHOP_STATE_ID', null, null, $id_shop);


        return AddressFormat::generateAddress($address, array(), '&lt;br /&gt;', ' ');
    }
</pre>
<p>This is everything it needs, but all of the old addresses will stay broken unless we do something for it!</p>
<h3>Fixing old addresses without state</h3>
<p>Open the file named <strong>HTMLTemplateInvoice.php</strong>, located in <em>classes/pdf</em>. The __construct method is what we are interested in, so right before the &#8220;// header informations&#8221; comment, add the following</p>
<pre class="brush: php; title: ; notranslate">
OrderInvoice::fixAllShopAddresses();
</pre>
<p>This would in theory fix all of the broken addresses. However, since the method only fills those entries without an address associated, we need to edit the function itself. As you can see, it&#8217;s part of the OrderInvoice class, so let&#8217;s hop back to it, and find it at the very end:</p>
<pre class="brush: php; title: ; notranslate">
    public static function fixAllShopAddresses()
    {
        $shopIds = Shop::getShops(false, null, true);
        $db = Db::getInstance();
        foreach ($shopIds as $idShop) {
            $address = static::getCurrentFormattedShopAddress($idShop);
            $escapedAddress = $db-&gt;escape($address, true, true);

            $db-&gt;execute('UPDATE `'._DB_PREFIX_.'order_invoice` INNER JOIN `'._DB_PREFIX_.'orders` USING (`id_order`)
                SET `shop_address` = \''.$escapedAddress.'\' WHERE `shop_address` IS NULL AND `id_shop` = '.$idShop);
        }
    }
</pre>
<p>See that part with the executing query, at the end of the function? We have to modify the query as follows:</p>
<pre class="brush: php; title: ; notranslate">

            $db-&gt;execute('UPDATE `'._DB_PREFIX_.'order_invoice` INNER JOIN `'._DB_PREFIX_.'orders` USING (`id_order`)
                SET `shop_address` = \''.$escapedAddress.'\' WHERE `id_shop` = '.$idShop);

</pre>
<p>Basically, we got rid of all the conditions apart from the shop one, so that all entries are updated. At this point you can try to load any old invoice to see the result. Bear in mind <strong>you have to do it at least twice, as that code we just added runs after the first generation process.</strong>.</p>
<p>Once it&#8217;s done you can revert back these last two changes, to avoid regenerating addresses every time.</p>
<p>The post <a rel="nofollow" href="http://nemops.com/add-the-state-to-your-shops-address-in-prestashop-invoices/">Add the state to your Shop&#8217;s Address in PrestaShop Invoices</a> appeared first on <a rel="nofollow" href="http://nemops.com">NemoPS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nemops.com/add-the-state-to-your-shops-address-in-prestashop-invoices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
