Remove shipping calculations from cart - magento-1.7

How can I remove the shipping calculations from the cart of my store?
This is the site: tintinportintin.com.br

On line 89 in app/design/frontend/base/default/checkout.xml you wil find:
<block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
This line is responsible for showing that block. You can copy this XML file to your own theme and remove this line.
But you can also use the <checkout_cart_index> handle and remove it. This can be done in local.xml for example.
<checkout_cart_index>
<remove name="checkout.cart.shipping" />
</checkout_cart_index>
Hope it helps !

Related

Adding URDF file for VLP-16 into Gazebo

I want to simulate an algorithm we wrote in Gazebo. The base robot I am using is the clearpath Husky. And, I need to put a Velodyne VLP-16 Lidar on it to extract the point clouds. The way I am going about it is trying to make my own custom world and launching the Husky launch file which spawns the Husky in a custom world. I just want to know what would be the best way to put the lidar on top of the husky? Can I just modify the world file? Or will I need to change the clearpath file? I downloaded the velodyne_simulator package from Velodyne and it comes with a VLP-16.urdf.xacro. Is there anyway I can use that? Any help would be appreciated. Thanks
The Husky allows for additional accessories to be added via the husky.urdf.xacro file indicated by this line of code in the file <xacro:include filename="$(arg urdf_extras)" />
The file can be located here https://github.com/husky/husky/blob/kinetic-devel/husky_description/urdf/husky.urdf.xacro
The final step is to add these lines of VLP-16 code to/path/to/my/file.urdf:
<VLP-16 parent="base_link" name="velodyne" topic="/velodyne_points">
<!-- The 0.2 will most likely have to be adjusted to fit -->
<origin xyz="0 0 0.2" rpy="0 0 0" />
</VLP-16>
Now the Husky can be launched with the VLP-16 in Gazebo.
roslaunch husky_gazebo husky_playpen.launch urdf_extras=/path/to/my/file.urdf
The answer by #mastash3ff is mostly correct except there are few things missing. As per the latest husky package you can bring up velodyne VLP-16 or say any model by setting "HUSKY_URDF_EXTRAS" environment variable to the urdf file you want to include.
export HUSKY_URDF_EXTRAS=/path/to/vlp.urdf
In my case vlp.urdf looked like this. You can also follow the same pattern
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="example">
<xacro:include filename="$(find velodyne_description)/urdf/VLP-16.urdf.xacro"/>
<VLP-16 parent="top_plate_link" name="velodyne" topic="/velodyne_points" hz="10" samples="440">
<origin xyz="0.2206 0.0 0.00635" rpy="0 0 0" />
</VLP-16>
</robot>
Hope this helps.

Edit length of increment_id in sales_order table on Magento 2

I want to decrease length of order increment #00000000001 to #00001.
I found some tutorials for magento 1 but not for Magento 2.
Please help if someone is aware how to perform this task.
Thanks
In the etc directory of your module, add a di.xml file with this content:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\SalesSequence\Model\Sequence">
<arguments>
<argument name="pattern" xsi:type="string"><![CDATA[%s%'.05d%s]]></argument>
</arguments>
</type>
</config>
This way Magento will pass a 5 digit pattern instead of its default pattern made by 9 digits.
This is because the first and the last %s symbol are replaced respectively with the prefix and the suffix values stored in the sales_sequence_profile table. The matching is done with the meta_id of your store (you can check yours by reading from the sales_sequence_meta table). The %'.05d pattern means that you want an integer with 5 padding digits on its left which is replaced with the next order number calculated by Magento.
For example, assuming that you have:
Prefix: PX
Suffix: SX
with the above pattern, the first order number will be PX00001SX
you can decrease length of order increment #00000000001 to #00001.
Try this: https://store.emizentech.com/magento2/custom-order-and-invoice-number-magento-2-0.html
Solved with a custom developed plugin:
I already had an observer to save the customer as new customer automatically after placing an order and before rendering the success page:
On the events.xml (already existing observer i've previously made)
<event name="sales_order_place_after">
<observer name="customcheckout_customer" instance="Dufry\CustomCheckout\Model\Observer\SaveCustomer"/>
</event>
On the observer SaveCustomer.php (already existing observer i've previously made):
$order = $observer->getOrder();
$increment = $order->getIncrementId();
if(strlen($increment) > 9){
$newIncrement = substr($increment, -8);
$newIncrement = substr($increment,0,1).$newIncrement;
$order->setIncrementId($newIncrement);
}
...
$order->save()
And worked like a charm.
I did the second "substr" part to keep the prefix the was previously configured.

Single OSSEC rule to supress alert_by_email

Im trying to supress/ignore the alert_by_email-option for every OSSEC-rule. The documentation suggests the following:
"Some rules have an option set to force OSSEC into sending an alert email. This option is alert_by_email. One of these rules is 1002. To ignore these rules you will have to create a rule to specifically ignore it, or overwrite the rule without the alert_by_email option."
However I could not find any example for creating a single role to ignore the option. Hope you guys can help me.
Add the following rule in your ossec/rules/local_rules.xml file:
Add the rule at the bottom of the file but make sure it is within the <group> tag.
<group>
...
..
...
<rule id="1002" level="2" overwrite="yes">
<options>no_email_alert</options>
<description>Unknown problem somewhere in the system.</description>
</rule>
</group>
This will stop sending email alerts for rule id=1002

Magento - Where are Anashrias Sandals

I know this has been asked before, but I seem to be going around in circles
Where in the magento file structure is the HTML file that displays amongst other things Anashrias Sandals(as well as Magentos end of summer sale etc...)
Ive installed the sample application to Magento CE V1.7.0.2
I can see the definition in Magento/Admin under CMS->Pages->Home Page->2 Columns with Left Bar, but Ive wondered all through the file system. The PHTML specifies the familiar
echo $this->getChildHtml('content')
But I cant seem to find anything that 'content' could resolve to that display Anashrias graceful feet and sandals
Content.phtml simply states
getPageContent(); ?>
Arghhhhhhh
Even turning debugging on puts dashed red lines around every block EXCEPT the content page
Sadly those wonderfully manicured toes must go
...but how
I was going to just comment, but to explain thoroughly I need more space ;)
To answer your comment directly, the content you see isn't necessarily in a file somewhere, the "content" for CMS pages are within your database. By changing the content field on your CMS Page (Magento Admin -> CMS -> Pages -> select a page from the list), you can change the center content for that page. Magento has many different page "types" (Each Parent of the tags in xml (explained later) is a layout handle signifying a page type), common examples are cms, category, product, checkout, cart, customer account, etc.
So, when you see $this->getChildHtml('content');, what you see is a call to the system to pull the child block named "content" from the XML. This changes depending on what page you are on, as dictated by the XML and Magento Core Code.
Layout Files
Lets take a look at the source of where the name "content" comes from. Our current working directory is /app/design/frontend/base/default/layout/. In this folder you will see a list of .xml files, these are the files that dictate how a page is put together. The block named "content" is originally defined in page.xml at around line 91:
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
Also, note that this section is "nested" in the <default></default> tags. Those tags are the layout handles I was talking about, and this shows that all pages should be loaded with this xml layout by default. So here is our "content" block, in all its glory. It's actually just a namespace. The other layout pages will each load what they need from within the content block.
Now, let's look at another relevant layout file, cms.xml, around line 45:
<cms_page translate="label">
<label>CMS Pages (All)</label>
<reference name="content">
<block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
<block type="page/html_wrapper" name="cms.wrapper" translate="label">
<label>CMS Content Wrapper</label>
<action method="setElementClass"><value>std</value></action>
<block type="cms/page" name="cms_page"/>
</block>
</reference>
</cms_page>
Here, the <reference name="content"> denotes that everything nested here is a child of the "content" block. We don't need to call it like <block name="content"/> because we know it was already defined in page.xml.
From there, they have the "cms.wrapper" block, which basically just sets the div that "wraps" around the rest of the cms content. Nested within the wrapper is our <block type="cms/page" name="cms_page"/>. This is the bad boy that outsources our template job to the cms/page block class, located in app/code/core/Mage/cms/page.php. From there, basically the class will grab our CMS Page detail from the database and present it for all to see.
So, to answer your question in short, there is no file that has the content of the cms pages, it is pulled from the database and generated upon page request.
Block Tag Explained
Blocks have various attributes to it, I'll go over the basics.
type="core/template": The type denotes what kind of block class it is. This refers to the folders nested in the "app/code/core/Mage/" folder (typically, with exceptions*). Here we are referring to app/code/core/Mage/Core/Block/Template.php. The class you set here will be attached to your template. This is responsible for the prolific use of $this->doSomething() in your template files. Basically the template file is calling the class object to do the work. "core/template" is a good general use class to fall back on when adding custom template files, although in certain circumstances you may need to choose something else.
name="content": Here we are giving our block a name. It would be the identifying name of the block, and it's used to reference that block everywhere. The block name is needed for such things as xml references (<reference name="blockName">) and to call blocks from within parent phtml template files (<?php echo $this->getChildHtml('blockName'); ?>). Note that all templates which call it without an argument ($this->getChildHtml('');) means to call ALL child blocks without being explicitly called.
as="content": This signifies an alias identifier. You can use the alias the same as the name above.
template="page/html/callouts.phtml": This sets the template for the block. Magento will look for app/design/frontend/your_package/your_theme/template/page/html/callouts.phtml and use it as the block's layout.
*Exceptions: Third-party extensions typically use either app/code/community or app/code/local folders. If you have to overwrite a core class, copy the directory structure to the local folder and then make your edits to the local version of the class.The classes load in this order: /local/ > /community/ > /core/. If a local version is found it will use that first, followed by community and core, and takes the first class file found with that name.
local.xml
Let me introduce you to the proper way of modifying your layout. Here, create a file called local.xml in your directory app/design/frontend/your_package/your_theme/layout/. This one file will house all your layout updates, to prevent any conflicts that may arise if you start editing the base layouts. Also, it keeps all your custom changes in one tidy file.
We'll remove some things that the demo store puts in that isn't really needed. Your layout should look like this, to start:
<?xml version="1.0"?>
<layout version="0.1.0">
<!-- Layout Handle -->
<default>
<!-- Block Reference -->
<reference name="left">
<!-- Remove by Reference Name -->
<remove name="left.permanent.callout"/>
</reference>
<reference name="right">
<remove name="right.permanent.callout"/>
</reference>
</default>
</layout>
Not a whole lot there, but what this will do is remove the callout ads on the left and right side bars. You'll need to refresh your cache upon making layout xml changes.
Read another one of my answers for some more things you can do with local.xml:
Magento Sidebar Customization
Edit 08/16/13:
I glossed over the Magento Design Guide (I had it once, good resource to start off, but by the first time I read it I already had learned everything it had to offer). The fallback structure it speaks of is in regarding the code/template/layout/skin/translation files.
The packages to use are partially set by you, in System->Configuration->Design. If it is not found, then it falls back to default. If default doesn't have what it's looking for, it grabs the base file. Magento does this inherently by design.
Unfortunately I don't see any built in mechanism for falling back database content. The cms content is made up of 4 tables, cms_block, cms_block_store, cms_page and cms_page_store. cms_block_store and cms_page_store each only contain the page/block id and the store id. both ids are primary keys. This is to relate the page/block id to which store it belongs to.
I suppose you could try to instigate a fallback for cms content by having it search for that page with store id, and if not, fall back to the same page ID from a different store. Or perhaps make a "base" store record that is only used as the fallback store id. I wouldn't be sure exactly how to implement either one though.
For your reference these are the cms_block and cms_page tables:
cms_block Table
[block_id] //Internal Id, Auto Increments and is Primary Key
[title] //Block Title as User Defined
[identifier] //Block Identifier, also User Defined
[content] //Block Content Stored Here
[creation_time] //Date-Time the Block was Created (ex. 2013-07-22 17:21:18)
[update_time] //Date-Time the Block was Last Updated
[is_active] //Show(1) or Hide(0) Block.
cms_page Table
[page_id] //Internal Id, Auto Increment, Primary Key
[title] //Page Title
[root_template] //Template Layout (one_column, two_columns_left, etc)
[meta_keywords] //Meta Keywords
[meta_description] //Meta Description
[identifier] //User Defined Page Identifier
[content_heading] //Content Heading to be Displayed
[content] //Page Content
[creation_time] //Date-Time Page Created
[update_time] //Date-Time Page Last Updated
[is_active] //Show(1) or Hide(0) Page (0 = 404 error)
[sort_order] //Legacy(?) Page Sorting Order**
[layout_update_xml] //XML Layout Changes***
[custom_theme] //Override Page w/ Different Theme
[custom_root_template] //Override Page w/ Different Layout than Set Above
[custom_layout_update_xml] //Override Page Layout w/ Different XML***
[custom_theme_from] //Set Date to Start Overriding Page w/ Custom Layout
[custom_theme_to] //Set Date to End Overriding Page w/ Custom Layout
/*
/**I don't see anywhere to set via Admin Back-End. All mine are set to (0),
/ my best guess is it was used to sort page link order in a menu. Either
/ they removed this feature somewhere along the way or I somehow removed
/ it and forgot.
/
/***Think local.xml without the need to use the layout handle. In other words:
/ You can modify specific pages with the same xml styling as used between
/ the <default></default> tags above. Don't actually put <?xml>, <layout>
/ or <default> (the update handle) tags.
*/
So that's all that is in the cms portion of the database.
Fallback
When properly configured, Magento will fall back in this order:
<!-- Front End Package/Theme Template and Layout Files -->
app/design/frontend/yourPackage/yourTheme/
app/design/frontend/yourPackage/default/
app/design/frontend/default/default/
app/design/frontend/base/default/
<!-- Admin Package/Theme Template and Layout Files -->
app/design/adminhtml/yourPackage/yourTheme/
app/design/adminhtml/yourPackage/default/
app/design/adminhtml/default/default/
<!-- Front End Package/Theme Skin (JS/CSS/Images) Files -->
skin/frontend/yourPackage/yourTheme/
skin/frontend/yourPackage/default/
skin/frontend/default/default/
skin/frontend/base/default/
<!-- Admin Package/Theme Skin (JS/CSS/Images) Files -->
skin/adminhtml/yourPackage/yourTheme/
skin/adminhtml/yourPackage/default/
skin/adminhtml/default/default/
<!-- Magento Code Pool -->
app/code/local/**
app/code/community/***
app/code/core/
/*
/**Magento will, by default, only look within local folders that currently
/ exist in the core directory, community directory*** OR if an active
/ module has codePool*** set to local.
/
/***Third-Party modules have to set which codePool they are using, which
/ specifies the default working directory for that module's code.
/ This is defined in the xml located at /app/etc/modules/*. If a module
/ has its codepool set to community, you can override the extension's
/ code by copying it to local.
/*
The "community" codePool is said to be there for legacy reasons, and that new extensions should be made to use the "local" only. I personally don't agree, it would make much more sense for every Third-Party extension to use the community codePool and retain the ability to override the original extension code from "local" without modifying the original.
Okay, I think I'm done with this question, as any more information here would be overload. If I missed anything, start a new question and link me to it ;D.

WiX: Preserve on major upgrade, remove on uninstall

I have defined a component to cleanup a generated (not installed) file on uninstall but leave intact on a major upgrade after reading this post
<Component Id="C_RemoveOnUninstall" Guid="XXX">
<RemoveFile Id="DeleteGeneratedFile" Name="ProgramGeneratedFile" On="uninstall"/>
<Condition>REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Condition>
</Component>
With condition above, the file is left behind for both upgrade and uninstall.
Without the condition, the file is deleted for both upgrade and uinstall.
I have tried RemoveFile for each of On="install/uninstall/both" but it does not seem to matter. Have read this post but I am hoping to make component conditions work and avoid writing custom action for this.
Does this code look correct? Any solutions or work around?
This approach assumes the RemoveFiles action ignores an item in the RemoveFile table when the property DirProperty referrers to has a value of null. The property DirProperty referrers to will be set during uninstall though not during an upgrade.
Conditionally set the property:
<SetProperty Id="prop_GeneratedFileDir" Value="[GeneratedFileDir]" After="InstallInitialize" Sequence="execute">
REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
</SetProperty>
Define an element for the RemoveFile table:
<Component Id="C_RemoveOnUninstall" Guid="XXX">
<RemoveFile Id="DeleteGeneratedFile" Property="prop_GeneratedFileDir" Name="ProgramGeneratedFile" On="uninstall"/>
<CreateFolder/>
</Component>
Some helpful links:
wix-users, RemoveFile Table, RemoveFile Element, RemoveFolderEx Element